Skip to main content

FutureResultCollection

Trait FutureResultCollection 

Source
pub trait FutureResultCollection<T, E>: FutureCollection<Result<T, E>> {
    // Required methods
    fn expect_ok(self, timeout: Duration, error_msg: &'static str);
    fn collect_ok<B>(self) -> B
       where B: FromIterator<T>;
    fn collect_ok_with_timeout<B>(
        self,
        timeout: Duration,
        error_msg: &'static str,
    ) -> B
       where B: FromIterator<T>;
}
Expand description

Convenience methods for collections containing future results

Required Methods§

Source

fn expect_ok(self, timeout: Duration, error_msg: &'static str)

Wait for all futures to complete successfully but ignore the result

Panics if any future fails to complete in time or the result is Err. Panics use the provided error_msg.

Timeout values are per future, not overall.

Source

fn collect_ok<B>(self) -> B
where B: FromIterator<T>,

Collect all the future results into a collection of type B

Panics if any future fails to complete or the result is Err.

Source

fn collect_ok_with_timeout<B>( self, timeout: Duration, error_msg: &'static str, ) -> B
where B: FromIterator<T>,

Collect all the future results into a collection of type B

Panics if any future fails to complete in time or the result is Err. Panics use the provided error_msg.

Timeout values are per future, not overall.

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<I, T, E> FutureResultCollection<T, E> for I
where T: Send + Debug, E: Send + Debug, I: IntoIterator<Item = KFuture<Result<T, E>>>,