Expand description
enumx = ENUM eXtensions.
See the enumx book for more.
Modules§
- export
- Reorganize types, traits and macros to export to end users.
- macros
- The predfined macros for implementing traits for enums
- predefined
- Predefined ad-hoc enums
- proto
- Since enums in Rust do not have prototypes, this mod does the work.
Macros§
- Enum
- Enum!( Type0, Type1, ..., TypeM )denotes a predefined enum, the definition of which looks like:
- def_impls 
- defines enums, with the syntax support of
- impl_all_ traits 
- The impl_all_traits!{}macro does whatimpl_trait!{}andimpl_super_traits!{}does, e.g.impl_all_traits!{ _impl!(Args) Fn<Args> _for!( Type )}will implementFn,FnMutandFnOnceforType.
- impl_super_ traits 
- The impl_super_traits!{}macro helps to implement the super trait(s) of the mentioned trait, e.g.impl_super_traits!{ _impl!(Args) Fn<Args> _for!( Type )}will implementFnMutandFnOnceforType, but NOTFn.
- impl_trait 
- For frequently used traits in std, this library provides macros such as
impl_trait!()to implement these traits without the need of writing trait methods.
Structs§
- EnumToEnum 
- Used in ExchangeFrom/ExchangeIntoto distinguish conversions between enums from those between an enum and its variant.
Traits§
- ExchangeFrom 
- Constructs an enum from one of its variants, or from an enum composed of a subset of its variants.
- ExchangeInto 
- Wraps a variant into an enum, or converts an enum into another one, the variants of which is a superset of the converted enum’s.
- FromVariant 
- Constructs an enum from one of its variants.
- IntoEnum 
- Wraps a variant into an enum.
- Proto
- Indicates the prototype for a user-defined Exchange-able enum.
Type Aliases§
- TyPat
- Wrapper for non-path types in type pattern matching using #[ty_pat]match
Attribute Macros§
- enumx
- tag an fnwith#[enumx]to enable “type pattern matching” inmatchexpressions that are tagged with#[ty_pat]/#[ty_pat(gen_variants)]/#[ty_pat(gen A,B,..)]`.
- sum
- collects all returned values in exit branches of the function, into an enum type, returning an impltrait
- sum_err
- To translate the expr?expressions in a different manner than the Rust’s default:
Derive Macros§
- Exchange
- derives enumx::Exchangetrait for custom definedenums
- FromVariant 
- Derives the trait enumx::FromVariantfor user defined enum types.
- Proto
- Since enums in Rust do not have prototypes, this macro derives them.