1 2 3 4 5 6 7 8 9 10 11 12
#[macro_export] macro_rules! impl_from_enum { ($($enum:ident::$variant:ident => $from:ty),*,) => { $( impl ::std::convert::From<$from> for $enum { fn from(v: $from) -> Self { $enum::$variant(v) } } )* } }