pub trait FutureCollection<T> {
// Required methods
fn expect_completion(self, timeout: Duration, error_msg: &'static str);
fn collect_with_timeout<B>(
self,
timeout: Duration,
) -> Result<B, WaitErr<()>>
where B: FromIterator<T>;
fn collect_results<B>(self) -> B
where B: FromIterator<T>;
}Expand description
Convenience methods for collections containing futures
Required Methods§
Sourcefn expect_completion(self, timeout: Duration, error_msg: &'static str)
fn expect_completion(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.
Panics use the provided error_msg.
Timeout values are per future, not overall.
Sourcefn collect_with_timeout<B>(self, timeout: Duration) -> Result<B, WaitErr<()>>where
B: FromIterator<T>,
fn collect_with_timeout<B>(self, timeout: Duration) -> Result<B, WaitErr<()>>where
B: FromIterator<T>,
Collect all the future results into a collection of type B
Returns an Err variant if any future fails to complete before timeout expires.
Timeout values are per future, not overall.
Sourcefn collect_results<B>(self) -> Bwhere
B: FromIterator<T>,
fn collect_results<B>(self) -> Bwhere
B: FromIterator<T>,
Collect all the future results into a collection of type B
Panics if any future fails to complete.
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.