Expand description
enum2str is a rust derive macro that creates Display and FromStr impls for enums.
This is useful for strongly typing composable sets of strings.
The crate is no_std
compatible and uses alloc
by default.
§Features
try_from_string
(optional): EnablesTryFrom<String>
implementation for enums with only unit variants. This feature is not enabled by default and requiresstd
. To enable it, use:enum2str = { version = "0.1.16", features = ["try_from_string"] }
§Usage
Add this to your Cargo.toml
:
enum2str = "0.1.16"
For no_std
environments, make sure you have alloc
available:
extern crate alloc;