Trait futures_state_stream::StateStream
[−]
[src]
pub trait StateStream { type Item; type State; type Error; fn poll(
&mut self
) -> Poll<StreamEvent<Self::Item, Self::State>, (Self::Error, Self::State)>; fn into_future(self) -> IntoFuture<Self>
where
Self: Sized, { ... } fn into_stream(self) -> IntoStream<Self>
where
Self: Sized, { ... } fn map<F, B>(self, f: F) -> Map<Self, F>
where
Self: Sized,
F: FnMut(Self::Item) -> B, { ... } fn map_err<F, B>(self, f: F) -> MapErr<Self, F>
where
Self: Sized,
F: FnMut(Self::Error) -> B, { ... } fn map_state<F, B>(self, f: F) -> MapState<Self, F>
where
Self: Sized,
F: FnOnce(Self::State) -> B, { ... } fn filter<F>(self, f: F) -> Filter<Self, F>
where
Self: Sized,
F: FnMut(&Self::Item) -> bool, { ... } fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F>
where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>, { ... } fn collect(self) -> Collect<Self>
where
Self: Sized, { ... } fn for_each<F>(self, f: F) -> ForEach<Self, F>
where
Self: Sized,
F: FnMut(Self::Item), { ... } }
A variant of futures::Stream
which returns a state value when it completes.
Associated Types
type Item
The items being streamed.
type State
The state returned when streaming completes.
type Error
The error returned.
Required Methods
fn poll(
&mut self
) -> Poll<StreamEvent<Self::Item, Self::State>, (Self::Error, Self::State)>
&mut self
) -> Poll<StreamEvent<Self::Item, Self::State>, (Self::Error, Self::State)>
Similar to Stream::poll
.
The end of a stream is indicated by a StreamEvent::Done
value. The result of calling
poll
after the end of the stream or an error has been reached is unspecified.
Provided Methods
fn into_future(self) -> IntoFuture<Self> where
Self: Sized,
Self: Sized,
Returns a future which yields the next element of the stream.
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
Self: Sized,
Returns a normal Stream
which yields the elements of this stream and discards the state.
fn map<F, B>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> B,
Self: Sized,
F: FnMut(Self::Item) -> B,
Returns a stream which applies a transform to items of this stream.
fn map_err<F, B>(self, f: F) -> MapErr<Self, F> where
Self: Sized,
F: FnMut(Self::Error) -> B,
Self: Sized,
F: FnMut(Self::Error) -> B,
Returns a stream which applies a transform to errors of this stream.
fn map_state<F, B>(self, f: F) -> MapState<Self, F> where
Self: Sized,
F: FnOnce(Self::State) -> B,
Self: Sized,
F: FnOnce(Self::State) -> B,
Returns a stream which applies a transform to the state of this stream.
fn filter<F>(self, f: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
Self: Sized,
F: FnMut(&Self::Item) -> bool,
Returns a stream which filters items of this stream by a predicate.
fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
Returns a stream which filters and transforms items of this stream by a predicate.
fn collect(self) -> Collect<Self> where
Self: Sized,
Self: Sized,
Returns a stream which collects all items of this stream into a Vec
, returning it along
with the stream's state.
fn for_each<F>(self, f: F) -> ForEach<Self, F> where
Self: Sized,
F: FnMut(Self::Item),
Self: Sized,
F: FnMut(Self::Item),
Returns a future which applies a closure to each item of this stream.
Implementations on Foreign Types
impl<S: ?Sized> StateStream for Box<S> where
S: StateStream,
[src]
S: StateStream,
type Item = S::Item
type State = S::State
type Error = S::Error
fn poll(&mut self) -> Poll<StreamEvent<S::Item, S::State>, (S::Error, S::State)>
[src]
fn into_future(self) -> IntoFuture<Self> where
Self: Sized,
[src]
Self: Sized,
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
[src]
Self: Sized,
fn map<F, B>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> B,
[src]
Self: Sized,
F: FnMut(Self::Item) -> B,
fn map_err<F, B>(self, f: F) -> MapErr<Self, F> where
Self: Sized,
F: FnMut(Self::Error) -> B,
[src]
Self: Sized,
F: FnMut(Self::Error) -> B,
fn map_state<F, B>(self, f: F) -> MapState<Self, F> where
Self: Sized,
F: FnOnce(Self::State) -> B,
[src]
Self: Sized,
F: FnOnce(Self::State) -> B,
fn filter<F>(self, f: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
[src]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
[src]
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn collect(self) -> Collect<Self> where
Self: Sized,
[src]
Self: Sized,
fn for_each<F>(self, f: F) -> ForEach<Self, F> where
Self: Sized,
F: FnMut(Self::Item),
[src]
Self: Sized,
F: FnMut(Self::Item),
impl<'a, S: ?Sized> StateStream for &'a mut S where
S: StateStream,
[src]
S: StateStream,
type Item = S::Item
type State = S::State
type Error = S::Error
fn poll(&mut self) -> Poll<StreamEvent<S::Item, S::State>, (S::Error, S::State)>
[src]
fn into_future(self) -> IntoFuture<Self> where
Self: Sized,
[src]
Self: Sized,
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
[src]
Self: Sized,
fn map<F, B>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> B,
[src]
Self: Sized,
F: FnMut(Self::Item) -> B,
fn map_err<F, B>(self, f: F) -> MapErr<Self, F> where
Self: Sized,
F: FnMut(Self::Error) -> B,
[src]
Self: Sized,
F: FnMut(Self::Error) -> B,
fn map_state<F, B>(self, f: F) -> MapState<Self, F> where
Self: Sized,
F: FnOnce(Self::State) -> B,
[src]
Self: Sized,
F: FnOnce(Self::State) -> B,
fn filter<F>(self, f: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
[src]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
[src]
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn collect(self) -> Collect<Self> where
Self: Sized,
[src]
Self: Sized,
fn for_each<F>(self, f: F) -> ForEach<Self, F> where
Self: Sized,
F: FnMut(Self::Item),
[src]
Self: Sized,
F: FnMut(Self::Item),
impl<S> StateStream for AssertUnwindSafe<S> where
S: StateStream,
[src]
S: StateStream,
type Item = S::Item
type State = S::State
type Error = S::Error
fn poll(&mut self) -> Poll<StreamEvent<S::Item, S::State>, (S::Error, S::State)>
[src]
fn into_future(self) -> IntoFuture<Self> where
Self: Sized,
[src]
Self: Sized,
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
[src]
Self: Sized,
fn map<F, B>(self, f: F) -> Map<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> B,
[src]
Self: Sized,
F: FnMut(Self::Item) -> B,
fn map_err<F, B>(self, f: F) -> MapErr<Self, F> where
Self: Sized,
F: FnMut(Self::Error) -> B,
[src]
Self: Sized,
F: FnMut(Self::Error) -> B,
fn map_state<F, B>(self, f: F) -> MapState<Self, F> where
Self: Sized,
F: FnOnce(Self::State) -> B,
[src]
Self: Sized,
F: FnOnce(Self::State) -> B,
fn filter<F>(self, f: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
[src]
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
[src]
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn collect(self) -> Collect<Self> where
Self: Sized,
[src]
Self: Sized,
fn for_each<F>(self, f: F) -> ForEach<Self, F> where
Self: Sized,
F: FnMut(Self::Item),
[src]
Self: Sized,
F: FnMut(Self::Item),
Implementors
impl<S, T> StateStream for FromStream<S, T> where
S: Stream, type Item = S::Item; type State = T; type Error = S::Error;impl<S, F, B> StateStream for Map<S, F> where
S: StateStream,
F: FnMut(S::Item) -> B, type Item = B; type State = S::State; type Error = S::Error;impl<S, F, B> StateStream for MapErr<S, F> where
S: StateStream,
F: FnMut(S::Error) -> B, type Item = S::Item; type State = S::State; type Error = B;impl<S, F, B> StateStream for MapState<S, F> where
S: StateStream,
F: FnOnce(S::State) -> B, type Item = S::Item; type State = B; type Error = S::Error;impl<T, F, Fut, It, St, E> StateStream for Unfold<T, F, Fut> where
F: FnMut(T) -> Fut,
Fut: IntoFuture<Item = StreamEvent<(It, T), St>, Error = (E, St)>, type Item = It; type State = St; type Error = E;impl<F, E, S> StateStream for FlattenStateStream<F> where
F: Future<Error = (E, S)>,
F::Item: StateStream<Error = E, State = S>, type Item = <F::Item as StateStream>::Item; type State = S; type Error = E;impl<S, F> StateStream for Filter<S, F> where
S: StateStream,
F: FnMut(&S::Item) -> bool, type Item = S::Item; type State = S::State; type Error = S::Error;impl<S, F, B> StateStream for FilterMap<S, F> where
S: StateStream,
F: FnMut(S::Item) -> Option<B>, type Item = B; type State = S::State; type Error = S::Error;