Make pallet macro generate accessor to PalletInfo information on pallet placeholder (#8630)

* generate accessor to PalletInfo information on pallet placeholder

* remove unused

* use trait, and add tests

* less verbose doc

* add PalletInfoAccess to prelude for ease usage
This commit is contained in:
Guillaume Thiolliere
2021-04-19 12:09:23 +02:00
committed by GitHub
parent d64f79924a
commit ea10494ca9
8 changed files with 67 additions and 4 deletions
@@ -31,6 +31,16 @@ pub trait PalletInfo {
fn name<P: 'static>() -> Option<&'static str>;
}
/// Provides information about the pallet setup in the runtime.
///
/// Access the information provided by [`PalletInfo`] for a specific pallet.
pub trait PalletInfoAccess {
/// Index of the pallet as configured in the runtime.
fn index() -> usize;
/// Name of the pallet as configured in the runtime.
fn name() -> &'static str;
}
/// The function and pallet name of the Call.
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug)]
pub struct CallMetadata {