safe-discriminant
safe-discriminant provides a minimalistic, no_std compatible trait and
procedural macro for extracting discriminants from enums at zero cost. It
automatically generates unsafe { ... } blocks, ensuring semantic safety so
you don’t have to worry about it.
Installation
This crate is available on crates.io and can be easily included in your project by:
- Adding the following line to your Cargo.toml:
[] = "0.1.0" - Or runing this command in your cargo project:
Usage
use Discriminant;
Similar Projects
- strum provides a collection of macros
designed to simplify working with enums. Among these macros is
EnumDiscriminants, which extracts the name of each variant from the enum and organizes them into a separate enum.