Derive Macro big_enum_set::BigEnumSetType
source · #[derive(BigEnumSetType)]
{
// Attributes available to this derive:
#[big_enum_set]
}
Expand description
Procedural derive generating impls for big_enum_set::BigEnumSetType
and associated traits.
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 implementingSub
,BitAnd
,BitOr
,BitXor
,Not
. - With
serde
, use#[big_enum_set(serialize_as_list)]
to serializeBigEnumSet
as list of elements instead of a bitset. - With
serde
, use#[big_enum_set(serialize_deny_unknown)]
to generate an error during derserialization ofBigEnumSet
for an unknown variant of the enum. - With
serde
, use#[big_enum_set(serialize_bytes=N)]
to serializeBigEnumSet
toN
bytes, rather than the minimum number of bytes needed to store the bitset. In other words,N >= V / 8 + 1
, whereV
is the largest discriminant.