Feature idea - enumeration variant matching
- Dominant language
- Rust
- Stars
- 151
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
Hey 👋🏾
I really like the fluid syntax of this library. While working with it, a few assertions would be great to have. Some of them are for ergonomics when working with enumeration variants. Like simple matching. So I could imagine for example something like:
```rust
enum Color {
RED,
GREEN,
BLUE,
RGB(u8, u8, u8),
}
assert_that!(Color::RED).matches(Color::RED);
assert_that!(Color::RGB(255, 0, 0)).matches(Color::RGB(_, _, _));
assert_that!(Color::RGB(255, 0, 0)).matches(Color::RGB(_, _, 0));
```
With the "default" API you can write these simply with `assert!(matches!(...))`. But then we have the syntax of the `assertor` it's `assert_that!` mixed with the other. Which does not read and feel great. So I though it might be easy enough to add this? 🙈
In any case: thanks for this library. Like it so far!
Contributor guide
Assessment
This issue has not been assessed yet.