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§
- This module provide helper traits and macro for bit related enumeration
- This module provides the core trait
Enumeration
- This modules provides utilities to the crate
- Convenience re-export of common members
- This module provides runtime representation of enumeration
Macros§
- 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 - This macro helps to create enum with trait
Enumeration
.