Attribute Macro solders_macros::enum_original_mapping
source · #[enum_original_mapping]
Expand description
Add mappings to and from another enum that has the exact same fields.
§Example
use solders_macros::enum_original_mapping;
#[derive(PartialEq, Debug)]
pub enum Foo {
A,
B
}
#[enum_original_mapping(Foo)]
#[derive(PartialEq, Debug)]
pub enum Bar {
A,
B,
}
let a = Bar::A;
let b = Foo::B;
assert_eq!(Foo::from(a), Foo::A);
assert_eq!(Bar::from(b), Bar::B);