Module enum_helpers

Source

Structsยง

MatchPattern ๐Ÿ”’

Enumsยง

EnumMethodKind

Functionsยง

derive_enum_variant_method
Generic helper for EnumIsA and EnumAsGetters. This generates one function per variant.
derive_variant_index_arity
Macro to derive a function fn variant_index_arity(&self) -> (u32, usize) the pair (variant index, variant arity). Only works on enumerations, of course.
derive_variant_name
Macro to derive a function fn variant_name(&self) -> String printing the constructor of an enumeration. Only works on enumerations, of course.
generate_variant_match_patterns ๐Ÿ”’
Generate matching patterns for an enumeration.
to_snake_case ๐Ÿ”’
We initially used the convert-case crate, but it converts names like โ€œI32โ€ to โ€œi_32โ€, while we want to get โ€œi32โ€. We thus reimplemented our own converter (which removes one dependency at the same time).