Attribute Macro frame_support::pallet_macros::type_value

source ·
Expand description

Allows defining a struct implementing the Get trait to ease the use of storage types.

This attribute is meant to be used alongside #[pallet::storage] to define a storage’s default value. This attribute can be used multiple times.

Item must be defined as:

mod pallet {
	pub struct Pallet<T>(_);

	pub(super) type SomeStorage<T: Config> =
		StorageValue<_, FixedU128, ValueQuery, DefaultForSomeValue>;

	// Define default for ParachainId
	pub fn DefaultForSomeValue() -> FixedU128 {

§Macro expansion

The macro renames the function to some internal name, generates a struct with the original name of the function and its generic, and implements Get<$ReturnType> by calling the user defined function.

Documentation for this macro can be found at frame_support::pallet_macros::type_value.