Rename pallet trait Trait to Config (#7599)

* rename Trait to Config

* add test asserting using Trait is still valid.

* fix ui tests
This commit is contained in:
Guillaume Thiolliere
2020-11-30 15:34:54 +01:00
committed by GitHub
parent dd3c84c362
commit 1cbfc9257f
200 changed files with 1767 additions and 1607 deletions
@@ -35,7 +35,7 @@ use proc_macro::TokenStream;
///
/// ```nocompile
/// decl_storage! {
/// trait Store for Module<T: Trait> as Example {
/// trait Store for Module<T: Config> as Example {
/// Foo get(fn foo) config(): u32=12;
/// Bar: map hasher(identity) u32 => u32;
/// pub Zed build(|config| vec![(0, 0)]): map hasher(identity) u32 => u32;
@@ -43,7 +43,7 @@ use proc_macro::TokenStream;
/// }
/// ```
///
/// Declaration is set with the header `(pub) trait Store for Module<T: Trait> as Example`,
/// Declaration is set with the header `(pub) trait Store for Module<T: Config> as Example`,
/// with `Store` a (pub) trait generated associating each storage item to the `Module` and
/// `as Example` setting the prefix used for storage items of this module. `Example` must be unique:
/// another module with the same name and the same inner storage item name will conflict.
@@ -169,7 +169,7 @@ use proc_macro::TokenStream;
///
/// ```nocompile
/// decl_storage! {
/// trait Store for Module<T: Trait> as Example {
/// trait Store for Module<T: Config> as Example {
///
/// // Your storage items
/// }
@@ -202,7 +202,7 @@ use proc_macro::TokenStream;
/// (`DefaultInstance` type is optional):
///
/// ```nocompile
/// trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Example {}
/// trait Store for Module<T: Config<I>, I: Instance=DefaultInstance> as Example {}
/// ```
///
/// Accessing the structure no requires the instance as generic parameter:
@@ -214,7 +214,7 @@ use proc_macro::TokenStream;
/// This macro supports a where clause which will be replicated to all generated types.
///
/// ```nocompile
/// trait Store for Module<T: Trait> as Example where T::AccountId: std::fmt::Display {}
/// trait Store for Module<T: Config> as Example where T::AccountId: std::fmt::Display {}
/// ```
///
/// ## Limitations
@@ -33,11 +33,11 @@ pub struct GenesisConfigFieldDef {
pub struct GenesisConfigDef {
pub is_generic: bool,
pub fields: Vec<GenesisConfigFieldDef>,
/// For example: `<T: Trait<I>, I: Instance=DefaultInstance>`.
/// For example: `<T: Config<I>, I: Instance=DefaultInstance>`.
pub genesis_struct_decl: TokenStream,
/// For example: `<T, I>`.
pub genesis_struct: TokenStream,
/// For example: `<T: Trait<I>, I: Instance>`.
/// For example: `<T: Config<I>, I: Instance>`.
pub genesis_impl: TokenStream,
/// The where clause to use to constrain generics if genesis config is generic.
pub genesis_where_clause: Option<syn::WhereClause>,
@@ -42,7 +42,7 @@ pub struct DeclStorageDef {
module_name: syn::Ident,
/// Usually `T`.
module_runtime_generic: syn::Ident,
/// Usually `Trait`
/// Usually `Config`
module_runtime_trait: syn::Path,
/// For instantiable module: usually `I: Instance=DefaultInstance`.
module_instance: Option<ModuleInstanceDef>,
@@ -77,7 +77,7 @@ pub struct DeclStorageDefExt {
module_name: syn::Ident,
/// Usually `T`.
module_runtime_generic: syn::Ident,
/// Usually `Trait`.
/// Usually `Config`.
module_runtime_trait: syn::Path,
/// For instantiable module: usually `I: Instance=DefaultInstance`.
module_instance: Option<ModuleInstanceDef>,
@@ -93,7 +93,7 @@ pub struct DeclStorageDefExt {
crate_name: syn::Ident,
/// Full struct expansion: `Module<T, I>`.
module_struct: proc_macro2::TokenStream,
/// Impl block for module: `<T: Trait, I: Instance>`.
/// Impl block for module: `<T: Config, I: Instance>`.
module_impl: proc_macro2::TokenStream,
/// For instantiable: `I`.
optional_instance: Option<proc_macro2::TokenStream>,
@@ -212,7 +212,7 @@ pub struct StorageLineDefExt {
storage_struct: proc_macro2::TokenStream,
/// If storage is generic over runtime then `T`.
optional_storage_runtime_comma: Option<proc_macro2::TokenStream>,
/// If storage is generic over runtime then `T: Trait`.
/// If storage is generic over runtime then `T: Config`.
optional_storage_runtime_bound_comma: Option<proc_macro2::TokenStream>,
/// The where clause to use to constrain generics if storage is generic over runtime.
optional_storage_where_clause: Option<proc_macro2::TokenStream>,