Crate enum2str

Crate enum2str 

Source
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): Enables TryFrom<String> implementation for enums with only unit variants. This feature is not enabled by default and requires std. 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;

Derive Macros§

EnumStr