Trait enum_variant_eq::EnumVariantEq
source · pub trait EnumVariantEq {
// Required method
fn enum_variant_eq(&self, other: &Self) -> bool;
}
Expand description
Determining whether the enumeration Variant are equal
Examples
use enum_variant_eq::{*,enum_variant_eq_derive::*};
#[derive(Debug, EnumVariantEq)]
enum TestEnum {
Unit,
EmptyUnNamed(),
UnNamed(i8),
UnNamed2(i8, u8),
EmptyNamed {},
Named { x: i8 },
Named2 { x: i8, y: u8 },
}
assert!(Unit.enum_variant_eq(&Unit));
assert!(UnNamed(5).enum_variant_eq(&UnNamed(8)));
assert!(Named { x: 5 }.enum_variant_eq(&Named { x: 8 }));