Crate enum_helpers

source ·

Derive Macros

  • Adds as_ methods to enums. These functions take self by reference and return an Option<&T> containing a reference to the value. These functions aren’t generated for unit types (empty types).
  • Adds as_mut_ methods to enums. These functions take self by mutable reference and return an Option<&mut T> containing a reference to the value. These functions aren’t generated for unit types (empty types).
  • Adds into_ methods to enums, These functions consume self and return an Option<T> containing the value. These functions aren’t generated for unit types (empty types).
  • Adds is_ methods to enums. These functions take self by reference and return a bool value whether the enum contains the value.