[][src]Derive Macro big_enum_set_derive::BigEnumSetType

#[derive(BigEnumSetType)]
{
    // Attributes available to this derive:
    #[big_enum_set]
}

Procedural derive generating [big_enum_set::BigEnumSetType] implementation.

Examples

use big_enum_set::BigEnumSetType;

#[derive(BigEnumSetType)]
#[big_enum_set(serialize_bytes="22")]
pub enum Enum {
   A, B, C, D, E, F, G,
}

The derivation may be customized by the following attributes.

  • Use #[big_enum_set(no_ops)] to disable automatically implementing [Sub], [BitAnd], [BitOr], [BitXor], [Not].
  • With serde, use #[big_enum_set(serialize_as_list)] to serialize [BigEnumSet] as list of elements instead of a bitset.
  • With serde, use #[big_enum_set(serialize_deny_unknown)] to generate an error during derserialization of [BigEnumSet] for an unknown variant of the enum.
  • With serde, use #[big_enum_set(serialize_bytes="N")] to serialize [BigEnumSet] to N bytes, rather than the minimum number of bytes needed to store the bitset. N >= number of variants / 8.