mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Implement PartialOrd and Ord on BoundedSlice and WeakBoundedVec (#11655)
* Implement PartialOrd and Ord on BoundedSlice and WeakBoundedVec * More implementations of PartialEq and PartialOrd * cargo fmt * Fixes
This commit is contained in:
@@ -66,6 +66,11 @@ where
|
||||
K: Ord,
|
||||
S: Get<u32>,
|
||||
{
|
||||
/// Create `Self` from `t` without any checks.
|
||||
fn unchecked_from(t: BTreeMap<K, V>) -> Self {
|
||||
Self(t, Default::default())
|
||||
}
|
||||
|
||||
/// Exactly the same semantics as `BTreeMap::retain`.
|
||||
///
|
||||
/// The is a safe `&mut self` borrow because `retain` can only ever decrease the length of the
|
||||
@@ -344,8 +349,7 @@ where
|
||||
if self.len() > Bound::get() as usize {
|
||||
Err("iterator length too big")
|
||||
} else {
|
||||
Ok(BoundedBTreeMap::<K, V, Bound>::try_from(self.collect::<BTreeMap<K, V>>())
|
||||
.expect("length checked above; qed"))
|
||||
Ok(BoundedBTreeMap::<K, V, Bound>::unchecked_from(self.collect::<BTreeMap<K, V>>()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user