Skip to main content

WidebandExt

Trait WidebandExt 

Source
pub trait WidebandExt<Item>
where Self: Stream<Item = Item> + Send + Sized,
{ // Required methods fn widen_filter_map<F, Fut, U, N>( self, n: N, f: F, ) -> impl Stream<Item = U> + Send where N: Into<Option<usize>>, F: Fn(Item) -> Fut + Send, Fut: Future<Output = Option<U>> + Send, U: Send; fn widen_then<F, Fut, U, N>( self, n: N, f: F, ) -> impl Stream<Item = U> + Send where N: Into<Option<usize>>, F: Fn(Item) -> Fut + Send, Fut: Future<Output = U> + Send, U: Send; // Provided methods fn wide_filter_map<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send where F: Fn(Item) -> Fut + Send, Fut: Future<Output = Option<U>> + Send, U: Send { ... } fn wide_then<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send where F: Fn(Item) -> Fut + Send, Fut: Future<Output = U> + Send, U: Send { ... } }
Expand description

Adds bounded concurrent transformations that preserve stream order.

Multiple item futures may run ahead of downstream demand. Completed outputs are held until every earlier input has produced its output.

Required Methods§

Source

fn widen_filter_map<F, Fut, U, N>( self, n: N, f: F, ) -> impl Stream<Item = U> + Send
where N: Into<Option<usize>>, F: Fn(Item) -> Fut + Send, Fut: Future<Output = Option<U>> + Send, U: Send,

Maps and filters items concurrently with an explicit width.

n limits in-flight item futures, while None selects the automatic width; an explicit zero cannot make progress. Present outputs retain source order and absent outputs are omitted.

Source

fn widen_then<F, Fut, U, N>(self, n: N, f: F) -> impl Stream<Item = U> + Send
where N: Into<Option<usize>>, F: Fn(Item) -> Fut + Send, Fut: Future<Output = U> + Send, U: Send,

Maps items concurrently with an explicit width while preserving order.

n limits in-flight item futures, while None selects the automatic width; an explicit zero cannot make progress. Item futures may run ahead, but outputs retain source order.

Provided Methods§

Source

fn wide_filter_map<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
where F: Fn(Item) -> Fut + Send, Fut: Future<Output = Option<U>> + Send, U: Send,

Maps and filters items concurrently with the automatic width.

Present outputs retain source order even when their futures complete out of order. Absent outputs are omitted.

Source

fn wide_then<F, Fut, U>(self, f: F) -> impl Stream<Item = U> + Send
where F: Fn(Item) -> Fut + Send, Fut: Future<Output = U> + Send, U: Send,

Maps items concurrently with the automatic width while preserving order.

Item futures may run ahead of downstream demand. Completed outputs wait for every earlier input before being yielded.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<Item, S> WidebandExt<Item> for S
where S: Stream<Item = Item> + Send + Sized,