#[derive(PyEnum)]
{
// Attributes available to this derive:
#[pyenum]
}
Expand description
Derive a pyenum::PyEnum implementation for a unit-variant Rust enum.
Enum-level attributes (all optional):
#[pyenum(base = "Enum" | "IntEnum" | "StrEnum" | "Flag" | "IntFlag")]— select the Python base class. Defaults to"Enum".#[pyenum(name = "...")]— override the Python class name. Defaults to the Rust enum identifier.
Variant-level attributes (all optional, mutually exclusive with a Rust discriminant on the same variant):
#[pyenum(value = "...")]— explicit Python string value. Only valid when the enum base isStrEnumorEnum. Without this attribute (and without a Rust discriminant),StrEnumvariants default to Python’sauto()semantics, which lowercase the variant name.