Skip to main content

TryBroadbandExt

Trait TryBroadbandExt 

Source
pub trait TryBroadbandExt<T, E>
where Self: TryStream<Ok = T, Error = E, Item = Result<T, E>> + Send + Sized,
{ // Required methods fn broadn_try_all<F, Fut, N>( self, n: N, f: F, ) -> impl Future<Output = Result<bool, E>> + Send where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send; fn broadn_try_any<F, Fut, N>( self, n: N, f: F, ) -> impl Future<Output = Result<bool, E>> + Send where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send; fn broadn_and_then<U, F, Fut, N>( self, n: N, f: F, ) -> impl TryStream<Ok = U, Error = E, Item = Result<U, E>> + Send where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = U, Error = E, Output = Result<U, E>> + Send; // Provided methods fn broad_try_all<F, Fut>( self, f: F, ) -> impl Future<Output = Result<bool, E>> + Send where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send { ... } fn broad_try_any<F, Fut>( self, f: F, ) -> impl Future<Output = Result<bool, E>> + Send where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send { ... } fn broad_and_then<U, F, Fut>( self, f: F, ) -> impl TryStream<Ok = U, Error = E, Item = Result<U, E>> + Send where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = U, Error = E, Output = Result<U, E>> + Send { ... } }
Expand description

Adds bounded concurrent transformations with completion-ordered outputs.

Successful item futures may run ahead of downstream demand, and their results are yielded as they complete. Source errors bypass the transform and may overtake queued item futures.

Required Methods§

Source

fn broadn_try_all<F, Fut, N>( self, n: N, f: F, ) -> impl Future<Output = Result<bool, E>> + Send
where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send,

Tests all successful items concurrently with an explicit width.

n limits in-flight predicates, None selects the automatic width, and an explicit zero cannot make progress. The first observed false or source or predicate error short-circuits; source errors may overtake queued predicates. An empty stream resolves Ok(true).

Source

fn broadn_try_any<F, Fut, N>( self, n: N, f: F, ) -> impl Future<Output = Result<bool, E>> + Send
where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send,

Tests successful items concurrently for any match with an explicit width.

n limits in-flight predicates, None selects the automatic width, and an explicit zero cannot make progress. The first observed true or source or predicate error short-circuits; source errors may overtake queued predicates. An empty stream resolves Ok(false).

Source

fn broadn_and_then<U, F, Fut, N>( self, n: N, f: F, ) -> impl TryStream<Ok = U, Error = E, Item = Result<U, E>> + Send
where N: Into<Option<usize>>, F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = U, Error = E, Output = Result<U, E>> + Send,

Transforms successful items concurrently with an explicit width.

n limits in-flight item futures, while None selects the automatic width; an explicit zero cannot make progress. Transformation results are completion ordered, while source errors bypass f and may overtake them.

Provided Methods§

Source

fn broad_try_all<F, Fut>( self, f: F, ) -> impl Future<Output = Result<bool, E>> + Send
where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send,

Tests all successful items concurrently with the automatic width.

The first observed false or source or predicate error short-circuits, so a false result can precede a pending error. An empty stream resolves Ok(true).

Source

fn broad_try_any<F, Fut>( self, f: F, ) -> impl Future<Output = Result<bool, E>> + Send
where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = bool, Error = E, Output = Result<bool, E>> + Send,

Tests successful items concurrently for any match with the automatic width.

The first observed true or source or predicate error short-circuits, so a true result can precede a pending error. An empty stream resolves Ok(false).

Source

fn broad_and_then<U, F, Fut>( self, f: F, ) -> impl TryStream<Ok = U, Error = E, Item = Result<U, E>> + Send
where F: Fn(Self::Ok) -> Fut + Send, Fut: TryFuture<Ok = U, Error = E, Output = Result<U, E>> + Send,

Transforms successful items concurrently with the automatic width.

Transformation results are yielded in completion order rather than source order. Existing source errors bypass f and may overtake queued futures.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, E, S> TryBroadbandExt<T, E> for S
where S: TryStream<Ok = T, Error = E, Item = Result<T, E>> + Send + Sized,