Allow pallet's info to be enumerated (#10053)

* Allow pallet's info to be enumerated

* Fixes

* Formatting

* Flat tuple for getting all pallet instances

* Renaming and fixing reversedness

* Formatting

* Fixes

* Back to nesting

* Back to nestingx

* Revert executive lib

* Reversions

* Reversions

* Fixes

* Fixes

* Formatting

* Fixes

* Spelling

* Comments
This commit is contained in:
Gavin Wood
2021-10-21 10:29:10 +02:00
committed by GitHub
parent 1660bc8cf2
commit 1dc753eb08
9 changed files with 187 additions and 7 deletions
+16
View File
@@ -2165,6 +2165,22 @@ macro_rules! decl_module {
}
}
impl<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?> $crate::traits::PalletsInfoAccess
for $mod_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )*
{
fn count() -> usize { 1 }
fn accumulate(acc: &mut $crate::sp_std::vec::Vec<$crate::traits::PalletInfoData>) {
use $crate::traits::PalletInfoAccess;
let item = $crate::traits::PalletInfoData {
index: Self::index(),
name: Self::name(),
module_name: Self::module_name(),
crate_version: Self::crate_version(),
};
acc.push(item);
}
}
// Implement GetCallName for the Call.
impl<$trait_instance: $trait_name $(<I>, $instance: $instantiable)?> $crate::dispatch::GetCallName
for $call_type<$trait_instance $(, $instance)?> where $( $other_where_bounds )*