referrerpolicy=no-referrer-when-downgrade
frame_support::pallet_macros

Attribute Macro constant

Source
#[constant]
Expand description

Allows adding an associated type trait bounded by Get from pallet::config into metadata.

§Example

#[frame_support::pallet]
mod pallet {
    use frame_support::pallet_prelude::*;
    #[pallet::config]
    pub trait Config: frame_system::Config {
		/// This is like a normal `Get` trait, but it will be added into metadata.
		#[pallet::constant]
		type Foo: Get<u32>;
	}
}

§Note on deprecation of constants

  • Usage of deprecated attribute will propagate deprecation information to the pallet metadata where the item was declared.
  • For general usage examples of deprecated attribute please refer to https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-deprecated-attribute
  • Usage of allow(deprecated) on the item will propagate this attribute to the generated code.
  • If the item is annotated with deprecated attribute then the generated code will be automatically annotated with allow(deprecated)

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