Attribute Macro frame_support::pallet_macros::composite_enum
source · #[composite_enum]
Expand description
The #[pallet::composite_enum]
attribute allows you to define an enum that gets composed as an
aggregate enum by construct_runtime
. This is similar in principle with #[pallet::event]
and
#[pallet::error]
.
The attribute currently only supports enum definitions, and identifiers that are named
FreezeReason
, HoldReason
, LockId
or SlashReason
. Arbitrary identifiers for the enum are
not supported. The aggregate enum generated by construct_runtime
will have the name of
RuntimeFreezeReason
, RuntimeHoldReason
, RuntimeLockId
and RuntimeSlashReason
respectively.
NOTE: The aggregate enum generated by construct_runtime
generates a conversion function from
the pallet enum to the aggregate enum, and automatically derives the following traits:
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, TypeInfo,
RuntimeDebug
For ease of usage, when no #[derive]
attributes are found for the enum under
#[pallet::composite_enum]
, the aforementioned traits are automatically derived for it. The
inverse is also true: if there are any #[derive]
attributes found for the enum, then no traits
will automatically be derived for it.