Expand description
Lightweight declarative macro for sets of strings.
strum_lite::strum! {
pub enum Casing {
Kebab = "kebab-case",
ScreamingSnake = "SCREAMING_SNAKE",
}
}§Features
- Implements
FromStrandDisplay. - 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::Errprovides 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;
}Macros§
- strum
- Give the passed in enum a
FromStrandDisplayimplementation. - with_
error - Like
strum!, but also declares a custom zero-sized error type, rather than using the pointer-wideParseError.
Structs§
- Parse
Error - Pointer-wide shared error type for
strum!.