Skip to main content

Crate strum_lite

Crate strum_lite 

Source
Expand description

Lightweight declarative macro for sets of strings.

strum_lite::strum! {
    pub enum Casing {
        Kebab = "kebab-case",
        ScreamingSnake = "SCREAMING_SNAKE",
    }
}

§Features

  • Implements FromStr and Display.
  • Attributes (docs, #[derive(..)]s) are passed through to the definition and variants.
  • Aliases are supported.
  • Custom enum discriminants are passed through.
  • #![no_std].
  • The generated FromStr::Err provides a helpful error message.
  • You may ask for a const slice of all the variants.
  • You may ask for a custom zero-sized error type rather than using this crate’s ParseError.

Macros§

strum
Give the passed-in enum a FromStr and Display implementation.

Structs§

ParseError
Pointer-wide shared error type for strum!.