pub trait BarterStreamExtwhere
Self: Stream,{
// Provided methods
fn with_timeout<TimeoutHandler>(
self,
timeout_next_item: Duration,
on_timeout: TimeoutHandler,
) -> impl Stream<Item = Self::Item>
where Self: Stream + Sized,
TimeoutHandler: FnOnce() + 'static { ... }
fn with_index<I>(self, indexer: I) -> IndexedStream<Self, I>
where Self: Stream<Item = I::Unindexed> + Sized,
I: Indexer { ... }
fn forward_by<A, B, FnPredicate, FnForward, FwdErr>(
self,
predicate: FnPredicate,
forward: FnForward,
) -> ForwardBy<Self, FnPredicate, FnForward>
where Self: Stream + Sized,
FnPredicate: Fn(Self::Item) -> Either<A, B>,
FnForward: FnMut(A) -> Result<(), FwdErr> { ... }
fn forward_clone_by<FnPredicate, FnForward, FwdErr>(
self,
predicate: FnPredicate,
forward: FnForward,
) -> ForwardCloneBy<Self, FnPredicate, FnForward>
where Self: Stream + Sized,
Self::Item: Clone,
FnPredicate: FnMut(&Self::Item) -> bool,
FnForward: FnMut(Self::Item) -> Result<(), FwdErr> { ... }
}Expand description
Stream extension trait.
Provided Methods§
Sourcefn with_timeout<TimeoutHandler>(
self,
timeout_next_item: Duration,
on_timeout: TimeoutHandler,
) -> impl Stream<Item = Self::Item>
fn with_timeout<TimeoutHandler>( self, timeout_next_item: Duration, on_timeout: TimeoutHandler, ) -> impl Stream<Item = Self::Item>
Add a “consecutive event timeout” to the Stream
Upon timeout, the Stream ends after executing the provided TimeoutHandler function.
Sourcefn with_index<I>(self, indexer: I) -> IndexedStream<Self, I>
fn with_index<I>(self, indexer: I) -> IndexedStream<Self, I>
Indexes the Stream using the provided Indexer.
Sourcefn forward_by<A, B, FnPredicate, FnForward, FwdErr>(
self,
predicate: FnPredicate,
forward: FnForward,
) -> ForwardBy<Self, FnPredicate, FnForward>
fn forward_by<A, B, FnPredicate, FnForward, FwdErr>( self, predicate: FnPredicate, forward: FnForward, ) -> ForwardBy<Self, FnPredicate, FnForward>
Forward a subset of Stream::Items.
All items that the predicate returns as Left and forwarded, whilst Right items
continue through the existing Stream.
Sourcefn forward_clone_by<FnPredicate, FnForward, FwdErr>(
self,
predicate: FnPredicate,
forward: FnForward,
) -> ForwardCloneBy<Self, FnPredicate, FnForward>
fn forward_clone_by<FnPredicate, FnForward, FwdErr>( self, predicate: FnPredicate, forward: FnForward, ) -> ForwardCloneBy<Self, FnPredicate, FnForward>
Forward a clone of a subset of Stream::Items that match the predicate. The Stream
still yields all items.