Skip to main content

simple_vocabulary

Macro simple_vocabulary 

macro_rules! simple_vocabulary {
    (
        $(#[$doc:meta])*
        $py:ident, $core:path, $name:literal, $module:literal, $label:literal;
        $( $variant:ident $(=> $rename:literal)? ),+ $(,)?
    ) => { ... };
    (@name $variant:ident) => { ... };
    (@name $variant:ident, $rename:literal) => { ... };
}
Expand description

A core vocabulary with no payload, crossing as a pyo3 simple enum.

One member per listed Rust variant, spelled as the variant unless renamed with => "Name" (a Rust None cannot be spelled Class.None in Python). The member reprs as Class.Member, strs as its code(), compares equal to itself and to its integer discriminant only, and hashes.