Attribute Macros§

  • Attribute macro used by the ‘Valued’ derive macro to indicate the type of your variant’s values, it poses as a simple derive macro, but it is used to modify your enum and prepare it for the Indexed and Valued traits, currently, this only means adding ‘#[repr(usize)]’ to your enum, and while it is unprobable, this macro is still reserved for manipulating your enum if new features were to need it, for this reason, this attribute should appear right after #[derive(Valued)] and before any other attributes.

Derive Macros§

  • Implements the ‘Indexed’ and ‘Valued’ traits for an enum, allowing to get a discriminant / index and a value for each variant through the functions ‘discriminant’ and ‘value’, and get this variant back using the functions ‘from_discriminant_opt’ and ‘value_to_variant_opt’.