enumeration/
lib.rs

1#![warn(missing_docs)]
2
3//! Provides extension to rust enum
4//!
5//! This crate provides [`crate::enumerate`] macro to generate rust `enum` with the following features
6//! - implementation for common traits ([`Clone`], [`Copy`], [`Hash`], etc.)
7//! - implementation of the useful trait [`enumeration::Enumeration`]
8//! - getting number of variants through constant [`enumeration::Enumeration::VARIANT_COUNT`]
9//! - casting to and from enumeration variant and enumeration index of type [`enumeration::Enumeration::Index`]
10//! - associating a constant value with each of the variants (with default value support [`enumeration::DefaultAssociatedValue`])
11//! - iterating through all variants [`enumeration::Enumeration::iter`]
12//! - two-way mapping for the variants and the associated constants [`enumeration::FromValue`]
13//! - bit-masking support
14//!     - wrapper that redefines some operators for greater bit-masking related bit operations
15//! - limited dynamic dispatch feature
16//!     - allow different [`enumeration::Enumeration<Index = T>`] to cast into [`variant::Variant<T>`]
17
18pub mod bitmask;
19pub mod enumeration;
20pub mod helper;
21pub mod variant;
22
23#[doc(hidden)]
24mod macros;
25
26/// Convenience re-export of common members
27pub mod prelude {
28    pub use crate::enumerate;
29    pub use crate::{enumeration::*, helper::*};
30}