Derive Macro utility_types::Exclude
source · #[derive(Exclude)]
{
// Attributes available to this derive:
#[exclude]
}
Expand description
Constructs an enum by excluding the set of variants from the original enum.
§Example
#[derive(Exclude)]
#[exclude(arg(ident = ExcludeMercury, variants(Mercury)))]
pub enum Planet {
Mercury,
Venus,
Earth,
Mars,
}The above code will generate the following enum:
pub enum ExcludeMercury {
Venus,
Earth,
Mars,
}§Attributes
ⓘ
#[derive(Exclude)]
#[exclude(
arg(
ident = <IDENT>, // The identifier of the generated enum
variants(<VARIANT>, ...), // The variants to exclude from the original enum
[derive(<DERIVE>, ...)], // Derive attributes for the generated enum
),
)]
pub enum BasedEnum {
variant: VariantType,
}