Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to check that some element matches a matcher #4

Open
talzion12 opened this issue Jul 28, 2020 · 1 comment
Open

Add ability to check that some element matches a matcher #4

talzion12 opened this issue Jul 28, 2020 · 1 comment

Comments

@talzion12
Copy link

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 =)

@mindsbackyard
Copy link
Owner

(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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants