-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow pallet's info to be enumerated #10053
Conversation
I'm not quite certain what the context behind this is, but you can return a |
Could do that, but it's probably faster to do one single heap allocation than to do |
T2::accumulate(acc); | ||
T1::accumulate(acc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ordering will produce vec![T2, T1], is that what we need to re-reverse the order of the pallets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed. i'll put a comment in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see problems from my side after the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
/// Relevant for tuples. | ||
/// | ||
/// You probably don't want this function but `infos()` instead. | ||
fn accumulate(_accumulator: &mut Vec<PalletInfoData>) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually prefer not to have default implementation when it needs to be overriden in most implementation, this can be error prone, someone can miss to override one implementation.
* 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
* 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
Followup to #9690, allowing the feature to actually be used.
Needed for paritytech/polkadot#4097.
Annoying this cannot be done outside of the module (e.g. in Polkadot) due to conflicting blanket impls of the trait
PalletInfoAccess
between pallets and tuples.It also cannot be done by returning an
impl Iterator
since apparently trait functions are not allowed to do this.