referrerpolicy=no-referrer-when-downgrade

Trait pallet_default_config_example::pallet::Config

source ·
pub trait Config: Config {
    type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>;
    type RuntimeTask: Task;
    type WithDefaultValue: Get<u32>;
    type OverwrittenDefaultValue: Get<u32>;
    type CanDeriveDefaultFromSystem: Get<Self::AccountId>;
    type HasNoDefault: Get<u32>;
    type CannotHaveDefault: Get<Self::RuntimeCall>;
    type WithDefaultType;
    type OverwrittenDefaultType;
}
Expand description

Configuration trait of this pallet.

The main purpose of this trait is to act as an interface between this pallet and the runtime in which it is embedded in. A type, function, or constant in this trait is essentially left to be configured by the runtime that includes this pallet.

Consequently, a runtime that wants to include this pallet must implement this trait. This pallet is annotated to have a default config. This will auto-generate DefaultConfig.

It will be an identical, but won’t have anything that is #[pallet::no_default].

Required Associated Types§

source

type RuntimeEvent: From<Event<Self>> + IsType<<Self as Config>::RuntimeEvent>

The overarching event type. This is coming from the runtime, and cannot have a default. In general, Runtime*-oriented types cannot have a sensible default.

source

type RuntimeTask: Task

The overarching task type.

source

type WithDefaultValue: Get<u32>

An input parameter to this pallet. This value can have a default, because it is not reliant on frame_system::Config or the overarching runtime in any way.

source

type OverwrittenDefaultValue: Get<u32>

Same as Config::WithDefaultValue, but we don’t intend to define a default for this in our tests below.

source

type CanDeriveDefaultFromSystem: Get<Self::AccountId>

An input parameter that relies on <Self as frame_system::Config>::AccountId. This can too have a default, as long as as it is present in frame_system::DefaultConfig.

source

type HasNoDefault: Get<u32>

We might chose to declare as one that doesn’t have a default, for whatever semantical reason.

source

type CannotHaveDefault: Get<Self::RuntimeCall>

Some types can technically have no default, such as those the rely on frame_system::Config but are not present in frame_system::DefaultConfig. For example, a RuntimeCall cannot reasonably have a default.

source

type WithDefaultType

Something that is a normal type, with default.

source

type OverwrittenDefaultType

Same as Config::WithDefaultType, but we don’t intend to define a default for this in our tests below.

Object Safety§

This trait is not object safe.

Implementors§