mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Ranked Collective pallet (#11548)
* Ranked Collective pallet * Fixes * benchmarks * Weights * Allow class voting in rank Use bare ayes for calculating support. Allow only promotion/demotion by one rank only. Allow removal of member with rank zero only. Use new Tally API * Index by rank, still O(1). * Custom vote weights * Formatting * Update frame/ranked-collective/src/lib.rs * Broken :( * origin guard; cleanup uses new API * Formatting * Promote/demote by rank * Formatting * Use new API * Remove code in another PR * Remove code in another PR * Formatting * Remove code in another PR * Docs * Docs * Bump * Fixes * Formatting * Fixes
This commit is contained in:
@@ -286,6 +286,12 @@ impl<T, S: Get<u32>> BoundedVec<T, S> {
|
||||
Self::with_bounded_capacity(Self::bound())
|
||||
}
|
||||
|
||||
/// Consume and truncate the vector `v` in order to create a new instance of `Self` from it.
|
||||
pub fn truncate_from(mut v: Vec<T>) -> Self {
|
||||
v.truncate(Self::bound());
|
||||
Self::unchecked_from(v)
|
||||
}
|
||||
|
||||
/// Get the bound of the type in `usize`.
|
||||
pub fn bound() -> usize {
|
||||
S::get() as usize
|
||||
|
||||
Reference in New Issue
Block a user