has_length is constrained by V: PartialEq + Debug but the fact that the value has PartialEq constraint is useless to count entries in the map. It is actually a problem in the following example.
struct Object(u32);
let mut map = HashMap::new();
map.insert(0, Object(42));
assert_that!(map).has_length(1);
This code produces the following error
error[E0599]: no method named `has_length` found for type `spectral::Spec<'_, std::collections::HashMap<{integer}, tests::from_gtfs_into_model::Object>>` in t
he current scope
--> gtfs/src/lib.rs:132:27
|
132 | assert_that!(map).has_length(1);
| ^^^^^^^^^^ method not found in `spectral::Spec<'_, std::collections::HashMap<{integer}, tests::from_gtfs_into_model::Object>>`
|
= note: the method `has_length` exists but the following trait bounds were not satisfied:
`spectral::Spec<'_, std::collections::HashMap<{integer}, tests::from_gtfs_into_model::Object>> : spectral::hashmap::HashMapAssertions<_, _>`
error: aborting due to previous error
A simple fix is the implementation of PartialEq on Object but that's not really on option for some objects.
has_lengthis constrained byV: PartialEq + Debugbut the fact that the value hasPartialEqconstraint is useless to count entries in the map. It is actually a problem in the following example.This code produces the following error
A simple fix is the implementation of
PartialEqonObjectbut that's not really on option for some objects.