#[derive(FromStrKind)]
{
// Attributes available to this derive:
#[from_str_kind]
}
Expand description
#[derive(FromStrKind)] — the inverse of Discriminant. Parses
a string back to a variant using the same case-folded variant
name. Only unit variants are supported (data variants need
caller-supplied payloads — out of scope for a string-only parse).
§Attributes
#[from_str_kind(case = "kebab" | "snake" | "lower" | "title")]— case transform matching the wire format (default"kebab")- Per-variant
#[from_str_kind(name = "explicit")]— match a specific wire string for this variant (overrides case transform) #[from_str_kind(error = "MyEnumParseError")]— name of the generated error type (default<EnumName>ParseError)
Pairs with Discriminant: when both derives are on the same enum
with the same case transform, s.parse() -> Ok(v); v.discriminant() == s
— a typed round-trip.