Expand description
Provides extension to rust enum
This crate provides crate::enumerate macro to generate rust enum with the following features
- implementation for common traits (
Clone,Copy,Hash, etc.) - implementation of the useful trait
enumeration::Enumeration - getting number of variants through constant
enumeration::Enumeration::VARIANT_COUNT - casting to and from enumeration variant and enumeration index of type
enumeration::Enumeration::Index - associating a constant value with each of the variants (with default value support
enumeration::DefaultAssociatedValue) - iterating through all variants
enumeration::Enumeration::iter - two-way mapping for the variants and the associated constants
enumeration::FromValue - bit-masking support
- wrapper that redefines some operators for greater bit-masking related bit operations
- limited dynamic dispatch feature
- allow different
enumeration::Enumeration<Index = T>to cast intovariant::Variant<T>
- allow different
Modules§
- bitmask
- This module provide helper traits and macro for bit related enumeration
- enumeration
- This module provides the core trait
Enumeration - helper
- This modules provides utilities to the crate
- prelude
- Convenience re-export of common members
- variant
- This module provides runtime representation of enumeration
Macros§
- bit_
enum - A specialized version of
crate::enumerate, it requires a non-optional associated value type (currently only integers are supported) that are automatically defined for each variant - count
- enumerate
- This macro helps to create enum with trait
Enumeration. - impl_
default - impl_
from_ value - impl_
try_ from_ into - validate