mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 05:47: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:
@@ -308,6 +308,17 @@ impl<T: Default> Get<T> for GetDefault {
|
||||
}
|
||||
}
|
||||
|
||||
/// Try and collect into a collection `C`.
|
||||
pub trait TryCollect<C> {
|
||||
/// The error type that gets returned when a collection can't be made from `self`.
|
||||
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>;
|
||||
}
|
||||
|
||||
macro_rules! impl_const_get {
|
||||
($name:ident, $t:ty) => {
|
||||
#[doc = "Const getter for a basic type."]
|
||||
|
||||
Reference in New Issue
Block a user