pub trait ActorStreamExt<A: Actor>: ActorStream<A> {
// Provided methods
fn map<F, U>(self, f: F) -> Map<Self, F>
where F: FnMut(Self::Item, &mut A, &mut A::Context) -> U,
Self: Sized { ... }
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
where F: FnMut(Self::Item, &mut A, &mut A::Context) -> Fut,
Fut: ActorFuture<A>,
Self: Sized { ... }
fn fold<F, Fut>(
self,
init: Fut::Output,
f: F,
) -> Fold<Self, F, Fut, Fut::Output>
where F: FnMut(Fut::Output, Self::Item, &mut A, &mut A::Context) -> Fut,
Fut: ActorFuture<A>,
Self: Sized { ... }
fn take_while<F, Fut>(self, f: F) -> TakeWhile<Self, Self::Item, F, Fut>
where F: FnMut(&Self::Item, &mut A, &mut A::Context) -> Fut,
Fut: ActorFuture<A, Output = bool>,
Self: Sized { ... }
fn skip_while<F, Fut>(self, f: F) -> SkipWhile<Self, Self::Item, F, Fut>
where F: FnMut(&Self::Item, &mut A, &mut A::Context) -> Fut,
Fut: ActorFuture<A, Output = bool>,
Self: Sized { ... }
fn timeout(self, timeout: Duration) -> Timeout<Self>
where Self: Sized { ... }
fn collect<C>(self) -> Collect<Self, C>
where C: Default + Extend<Self::Item>,
Self: Sized { ... }
fn finish(self) -> Finish<Self>
where Self: Sized { ... }
}
Provided Methods§
Sourcefn map<F, U>(self, f: F) -> Map<Self, F>
fn map<F, U>(self, f: F) -> Map<Self, F>
Maps this stream’s items to a different type, returning a new stream of the resulting type.
The provided closure is executed over all elements of this stream as
they are made available. It is executed inline with calls to
poll_next
.
Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing map
methods in the
standard library.
Sourcefn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
Computes from this stream’s items new items of a different type using an asynchronous closure.
The provided closure f
will be called with an Item
once a value is
ready, it returns a future which will then be run to completion
to produce the next value on this stream.
Note that this function consumes the stream passed into it and returns a wrapped version of it.
Sourcefn fold<F, Fut>(
self,
init: Fut::Output,
f: F,
) -> Fold<Self, F, Fut, Fut::Output>
fn fold<F, Fut>( self, init: Fut::Output, f: F, ) -> Fold<Self, F, Fut, Fut::Output>
Execute an accumulating asynchronous computation over a stream, collecting all the values into one final result.
This combinator will accumulate all values returned by this stream according to the closure provided. The initial state is also provided to this method and then is returned again by each execution of the closure. Once the entire stream has been exhausted the returned future will resolve to this value.
Sourcefn take_while<F, Fut>(self, f: F) -> TakeWhile<Self, Self::Item, F, Fut>
fn take_while<F, Fut>(self, f: F) -> TakeWhile<Self, Self::Item, F, Fut>
Take elements from this stream while the provided asynchronous predicate
resolves to true
.
This function, like Iterator::take_while
, will take elements from the
stream until the predicate f
resolves to false
. Once one element
returns false
, it will always return that the stream is done.
Sourcefn skip_while<F, Fut>(self, f: F) -> SkipWhile<Self, Self::Item, F, Fut>
fn skip_while<F, Fut>(self, f: F) -> SkipWhile<Self, Self::Item, F, Fut>
Skip elements on this stream while the provided asynchronous predicate
resolves to true
.
This function, like Iterator::skip_while
, will skip elements on the
stream until the predicate f
resolves to false
. Once one element
returns false
, all future elements will be returned from the underlying
stream.
Sourcefn timeout(self, timeout: Duration) -> Timeout<Self>where
Self: Sized,
fn timeout(self, timeout: Duration) -> Timeout<Self>where
Self: Sized,
Add timeout to stream.
Err(())
returned as a timeout error.