galvanic-assert
galvanic-assert copied to clipboard
Add ability to check that some element matches a matcher
I'd like to be able to write something like this:
struct Person {
name: &'static str,
age: u32,
}
let people = vec![
Person {name: "Hi", age: 32 },
Person {name: "Bye", age: 33 },
];
assert_that!(&people, contains_in_any_order(&[
has_structure!(Person { name: eq("Hi") }),
has_structure!(Person { name: eq("Bye") }),
]));
This probably doesn't compile, but I think it explains the issue well.
Great library btw =)
(sry I know that this is an old issue) Thanks! I'm not exactly what the problem is but the purpose for has_structure! is exactly the above scenario. Maybe I missed something though.