referrerpolicy=no-referrer-when-downgrade

Trait frame_support::traits::TryCollect

pub trait TryCollect<C> {
    type Error;

    // Required method
    fn try_collect(self) -> Result<C, Self::Error>;
}
Expand description

Try and collect into a collection C.

Required Associated Types§

type Error

The error type that gets returned when a collection can’t be made from self.

Required Methods§

fn try_collect(self) -> Result<C, Self::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).

Implementors§

§

impl<I, K, V, Bound> TryCollect<BoundedBTreeMap<K, V, Bound>> for I
where K: Ord, I: ExactSizeIterator<Item = (K, V)> + Iterator, Bound: Get<u32>,

§

type Error = &'static str

§

impl<I, T, Bound> TryCollect<BoundedBTreeSet<T, Bound>> for I
where T: Ord, I: ExactSizeIterator<Item = T> + Iterator, Bound: Get<u32>,

§

type Error = &'static str

§

impl<I, T, Bound> TryCollect<BoundedVec<T, Bound>> for I
where I: ExactSizeIterator<Item = T> + Iterator, Bound: Get<u32>,

§

type Error = &'static str