CollectAll

Trait CollectAll 

Source
pub trait CollectAll<T, E: Error + From<Vec<E>>>: Iterator<Item = Result<T, E>> + Sized {
    // Provided methods
    fn collect_all<TC: FromIterator<T> + Extend<T> + Default>(
        self,
    ) -> Result<TC, E> { ... }
    fn collect_all_vec(self) -> Result<Vec<T>, E> { ... }
    fn collect_errors(self) -> Result<(), E> { ... }
}
Expand description

Collect an iterator of Results<T, E> into a container of T and a vector of E, then pack all the errors in a single error of the same type. Requires that E can be constructed from a Vec.

Provided Methods§

Source

fn collect_all<TC: FromIterator<T> + Extend<T> + Default>(self) -> Result<TC, E>

Collect the results into a container of successes, or pack all errors. Contrary to collect<Result<Vec<T>, E>>, this method collects all errors instead of stopping at the first one.

Source

fn collect_all_vec(self) -> Result<Vec<T>, E>

Collect the results into a container of successes, or pack all errors. Contrary to collect<Result<Vec<T>, E>>, this method collects all errors instead of stopping at the first one.

Source

fn collect_errors(self) -> Result<(), E>

Collect the results, returning Ok(()) if all succeeded, or packing all errors

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, E: Error + From<Vec<E>>, I: Iterator<Item = Result<T, E>>> CollectAll<T, E> for I