mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 06:51:07 +00:00
Rename ModuleToIndex to PalletRuntimeSetup (#7148)
* Rename `ModuleToIndex` to `PalletRuntimeSetup` Besides the renaming it also adds support getting the name of a pallet as configured in the runtime. * Rename it to `PalletInfo` * Remove accidentally added files
This commit is contained in:
@@ -1313,8 +1313,6 @@ impl<T: Clone + Ord> ChangeMembers<T> for () {
|
||||
fn set_prime(_: Option<T>) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Trait for type that can handle the initialization of account IDs at genesis.
|
||||
pub trait InitializeMembers<AccountId> {
|
||||
/// Initialize the members to the given `members`.
|
||||
@@ -1380,16 +1378,20 @@ pub trait ValidatorRegistration<ValidatorId> {
|
||||
fn is_registered(id: &ValidatorId) -> bool;
|
||||
}
|
||||
|
||||
/// Something that can convert a given module into the index of the module in the runtime.
|
||||
/// Provides information about the pallet setup in the runtime.
|
||||
///
|
||||
/// The index of a module is determined by the position it appears in `construct_runtime!`.
|
||||
pub trait ModuleToIndex {
|
||||
/// Convert the given module `M` into an index.
|
||||
fn module_to_index<M: 'static>() -> Option<usize>;
|
||||
/// An implementor should be able to provide information about each pallet that
|
||||
/// is configured in `construct_runtime!`.
|
||||
pub trait PalletInfo {
|
||||
/// Convert the given pallet `P` into its index as configured in the runtime.
|
||||
fn index<P: 'static>() -> Option<usize>;
|
||||
/// Convert the given pallet `P` into its name as configured in the runtime.
|
||||
fn name<P: 'static>() -> Option<&'static str>;
|
||||
}
|
||||
|
||||
impl ModuleToIndex for () {
|
||||
fn module_to_index<M: 'static>() -> Option<usize> { Some(0) }
|
||||
impl PalletInfo for () {
|
||||
fn index<P: 'static>() -> Option<usize> { Some(0) }
|
||||
fn name<P: 'static>() -> Option<&'static str> { Some("test") }
|
||||
}
|
||||
|
||||
/// The function and pallet name of the Call.
|
||||
|
||||
Reference in New Issue
Block a user