mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Only maintain at most 1 UnlockChunk per era (#10670)
* Only maintain at most 1 `UnlockChunk` per era * Bound `unlocking` * Run cargo +nightly-2021-10-29 fmt * Make benchmarks stuff compile * Update frame/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Remove DerefMut; Implement neccesary methods directly * Doc comments for new BoundedVec methods * Fix benchmarks * wip bonded_vec macro * Correct rust doc * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update staking::Config impls * Add MaxUnlockingChunks to more places * Use defensive saturating add * FMT Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@ use crate::{
|
||||
};
|
||||
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::{
|
||||
ops::{Deref, Index, IndexMut},
|
||||
ops::{Deref, Index, IndexMut, RangeBounds},
|
||||
slice::SliceIndex,
|
||||
};
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
@@ -178,6 +178,19 @@ impl<T, S> BoundedVec<T, S> {
|
||||
pub fn iter_mut(&mut self) -> core::slice::IterMut<'_, T> {
|
||||
self.0.iter_mut()
|
||||
}
|
||||
|
||||
/// Exactly the same semantics as [`slice::last_mut`].
|
||||
pub fn last_mut(&mut self) -> Option<&mut T> {
|
||||
self.0.last_mut()
|
||||
}
|
||||
|
||||
/// Exact same semantics as [`Vec::drain`].
|
||||
pub fn drain<R>(&mut self, range: R) -> sp_std::vec::Drain<'_, T>
|
||||
where
|
||||
R: RangeBounds<usize>,
|
||||
{
|
||||
self.0.drain(range)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S: Get<u32>> From<BoundedVec<T, S>> for Vec<T> {
|
||||
|
||||
Reference in New Issue
Block a user