mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
some improvements to bounded vec API (#10590)
* some improvements to bounded vec * revert license tweak * more tests * fix * Update frame/support/src/storage/bounded_vec.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * add the same stuff for btree map and set as well Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,16 @@ use scale_info::{build::Fields, meta_type, Path, Type, TypeInfo, TypeParameter};
|
||||
use sp_runtime::{traits::Block as BlockT, DispatchError};
|
||||
use sp_std::{cmp::Ordering, prelude::*};
|
||||
|
||||
/// 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