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§

source

fn map<F, U>(self, f: F) -> Map<Self, F>
where F: FnMut(Self::Item, &mut A, &mut A::Context) -> U, Self: Sized,

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.

source

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,

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.

source

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,

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.

source

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,

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.

source

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,

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.

source

fn timeout(self, timeout: Duration) -> Timeout<Self>
where Self: Sized,

Add timeout to stream.

Err(()) returned as a timeout error.

source

fn collect<C>(self) -> Collect<Self, C>
where C: Default + Extend<Self::Item>, Self: Sized,

Transforms a stream into a collection, returning a future representing the result of that computation.

The returned future will be resolved when the stream terminates.

source

fn finish(self) -> Finish<Self>
where Self: Sized,

Transforms a stream to a future that resolves when stream finishes.

Implementors§

source§

impl<A, S> ActorStreamExt<A> for S
where S: ActorStream<A>, A: Actor,