pub fn container_eq<ExpectedContainerT>(
expected: ExpectedContainerT,
) -> ContainerEqMatcher<ExpectedContainerT>where
ExpectedContainerT: Debug,Expand description
Matches a container equal (in the sense of ==) to expected.
This is similar to crate::matchers::eq except that an assertion failure
message generated from this matcher will include the missing and unexpected
items in the actual value, e.g.:
Expected container to equal [1, 2, 3]
but was: [1, 2, 4]
Missing: [3]
Unexpected: [4]The actual value must be a container such as a &Vec, an array, or a
dereferenced slice. More precisely, the actual value must
implement IntoIterator whose Item type implements
PartialEq<ExpectedT>, where ExpectedT is the element type of the
expected value.
let vec = vec![1, 2, 3];
verify_that!(vec, container_eq([1, 2, 3]))?;Performance note: In the event of a mismatch leading to an assertion failure, the construction of the lists of missing and unexpected values uses a naive algorithm requiring time proportional to the product of the sizes of the expected and actual values. This should therefore only be used when the containers are small enough that this is not a problem.