[−][src]Macro enum_derive_2018::EnumInnerAsTrait
Derives a method for an unary enum returning a borrowed pointer to the inner value, cast to a trait object.
EnumInnerAsTrait!
accepts a single deriving form that specifies the name of the method to be derived,
whether the borrow should be mutable, and the trait of interest.
For example:
macro_attr! { #[derive(EnumInnerAsTrait!(pub as_display -> &dyn std::fmt::Display))] enum Value { U32(u32), U64(u64), } } let s = format!("{}", Value::U64(42).as_display()); assert_eq!(&s[..], "42");