Macro galvanic_assert::is_variant
[−]
[src]
macro_rules! is_variant { ( $variant: path ) => { ... }; }
Matches if the asserted value's variant matches the expected variant.
Examples
If the enum's variants are already imported one can write:
assert_that!(Ok(4), is_variant!(Ok));
If not then the full path of the variant has to be used:
```
enum MyEnum { Foo, Bar(i32), Baz{x: i32} }
assert_that!(MyEnum::Baz{x: 2}, is_variant!(MyEnum::Baz)); ```