enum_methods

Attribute Macro enum_methods 

Source
#[enum_methods]
Expand description

The generated methods assume that TargetType provides an appropriate untag() method (and untag_mut() if mutable access methods are used) that allows access to the underlying enum (MyEnum in the example).

For methods that construct a new instance of TargetType (like and_then, or_else), it’s assumed that the enum variant (e.g., MyEnum::Tuple(...)) can be converted into TargetType via .into(). This means TargetType must implement From<MyEnum>.