mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Ensure data size of identity pallet is bounded (#9168)
* Ensure data size of identity pallet is bounded * Fix unit tests for identity pallet * Move identity pallet custom types into its own module * Make use of NoBound family traits * Fix identity pallet benchmarks * Enumerate type imports * Properly convert to BoundedVec in benchmarks * Re-export types * Use BoundedVec when storing sub identities * Add generate_storage_info * Manually implement MaxEncodedLen on select types * Use ConstU32 instead of parameter_type * Leverage DefaultNoBound and add some comments * Use max_encoded_len() instead of hardcoded constant * Use MaxEncodedLen in parity-scal-codec * Add get_mut method for WeakBoundedVec * Use expect on an infallible operation * Rewrite as for loop
This commit is contained in:
@@ -122,6 +122,14 @@ impl<T, S> BoundedVec<T, S> {
|
||||
pub fn retain<F: FnMut(&T) -> bool>(&mut self, f: F) {
|
||||
self.0.retain(f)
|
||||
}
|
||||
|
||||
/// Exactly the same semantics as [`Vec::get_mut`].
|
||||
pub fn get_mut<I: SliceIndex<[T]>>(
|
||||
&mut self,
|
||||
index: I,
|
||||
) -> Option<&mut <I as SliceIndex<[T]>>::Output> {
|
||||
self.0.get_mut(index)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S: Get<u32>> From<BoundedVec<T, S>> for Vec<T> {
|
||||
|
||||
Reference in New Issue
Block a user