mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Move bounded type definitions to sp-runtime (#11645)
* Move bounded type definitions to sp-runtime * cargo fmt * Fix compile error Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Move TryCollect to sp-runtime * Write some docs * Import missing types Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -24,7 +24,7 @@ use sp_arithmetic::traits::{CheckedAdd, CheckedMul, CheckedSub, Saturating};
|
||||
#[doc(hidden)]
|
||||
pub use sp_runtime::traits::{
|
||||
ConstBool, ConstI128, ConstI16, ConstI32, ConstI64, ConstI8, ConstU128, ConstU16, ConstU32,
|
||||
ConstU64, ConstU8, Get, GetDefault, TypedGet,
|
||||
ConstU64, ConstU8, Get, GetDefault, TryCollect, TypedGet,
|
||||
};
|
||||
use sp_runtime::{traits::Block as BlockT, DispatchError};
|
||||
use sp_std::{cmp::Ordering, prelude::*};
|
||||
@@ -367,16 +367,6 @@ impl<T: Saturating + CheckedAdd + CheckedMul + CheckedSub> DefensiveSaturating f
|
||||
}
|
||||
}
|
||||
|
||||
/// Try and collect into a collection `C`.
|
||||
pub trait TryCollect<C> {
|
||||
type Error;
|
||||
/// Consume self and try to collect the results into `C`.
|
||||
///
|
||||
/// This is useful in preventing the undesirable `.collect().try_into()` call chain on
|
||||
/// collections that need to be converted into a bounded type (e.g. `BoundedVec`).
|
||||
fn try_collect(self) -> Result<C, Self::Error>;
|
||||
}
|
||||
|
||||
/// Anything that can have a `::len()` method.
|
||||
pub trait Len {
|
||||
/// Return the length of data type.
|
||||
|
||||
Reference in New Issue
Block a user