strum-lite 0.1.0

Lightweight declarative macro for sets of strings.
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented3 out of 4 items with examples
  • Size
  • Source code size: 11.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 583.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • aatifsyed/strum-lite
    9 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • aatifsyed

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.
  • Generated code is #![no_std].
  • The generated FromStr::Err provides a helpful error message.
  • You may ask for a custom error type rather than using this crate's [ParseError].
strum_lite::with_error! {
    #[derive(Default)]
    #[repr(u8)]
    pub enum Casing {
        Kebab = "kebab-case" | "kebab" = 1,
        #[default]
        ScreamingSnake = "SCREAMING_SNAKE" = 1 + 2,
    }
    throws
    #[derive(Clone, Copy)]
    ParseCasingError;
}