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>; fn boxed(self) -> BoxStateStream<Self::Item, Self::State, Self::Error>
where
Self: Sized + Send + 'static, { ... } 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 then<F, U>(self, f: F) -> Then<Self, F, U>
where
Self: Sized,
F: FnMut(Result<Self::Item, Self::Error>) -> U,
U: IntoFuture,
Self::Error: From<U::Error>, { ... } fn and_then<F, U>(self, f: F) -> AndThen<Self, F, U>
where
Self: Sized,
F: FnMut(Self::Item) -> U,
U: IntoFuture,
Self::Error: From<U::Error>, { ... } fn and_then_state<F, U>(self, f: F) -> AndThenState<Self, F, U>
where
Self: Sized,
F: FnMut(Self::State) -> U,
U: IntoFuture,
Self::Error: From<U::Error>, { ... } fn or_else<F, U>(self, f: F) -> OrElse<Self, F, U>
where
Self: Sized,
F: FnMut(Self::Error) -> U,
U: IntoFuture<Item = Self::Item>, { ... } fn collect(self) -> Collect<Self>
where
Self: Sized, { ... } fn fold<T, F, Fut, G, Fut2>(
self,
init: T,
next: F,
done: G
) -> Fold<Self, T, F, Fut, G, Fut2>
where
Self: Sized,
F: FnMut(T, Self::Item) -> Fut,
Fut: IntoFuture<Item = T>,
Self::Error: From<Fut::Error>,
G: FnOnce(T, Self::State) -> Fut2,
Fut2: IntoFuture<Item = T>,
Self::Error: From<Fut2::Error>, { ... } fn skip_while<P, R>(self, pred: P) -> SkipWhile<Self, P, R>
where
Self: Sized,
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>, { ... } fn for_each<F>(self, f: F) -> ForEach<Self, F>
where
Self: Sized,
F: FnMut(Self::Item) -> Result<(), Self::Error>, { ... } fn catch_unwind(self) -> CatchUnwind<Self>
where
Self: Sized + UnwindSafe, { ... } fn buffered(self, amt: usize) -> Buffered<Self>
where
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>, { ... } fn buffered_unordered(self, amt: usize) -> BufferedUnordered<Self>
where
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>, { ... } }
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>
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 boxed(self) -> BoxStateStream<Self::Item, Self::State, Self::Error> where
Self: Sized + Send + 'static,
Self: Sized + Send + 'static,
Returns this stream as a boxed trait object.
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 then<F, U>(self, f: F) -> Then<Self, F, U> where
Self: Sized,
F: FnMut(Result<Self::Item, Self::Error>) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Self: Sized,
F: FnMut(Result<Self::Item, Self::Error>) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Returns a stream which transforms results of this stream into a new future.
fn and_then<F, U>(self, f: F) -> AndThen<Self, F, U> where
Self: Sized,
F: FnMut(Self::Item) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Self: Sized,
F: FnMut(Self::Item) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Returns a stream which transforms items of this stream into a new future.
fn and_then_state<F, U>(self, f: F) -> AndThenState<Self, F, U> where
Self: Sized,
F: FnMut(Self::State) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Self: Sized,
F: FnMut(Self::State) -> U,
U: IntoFuture,
Self::Error: From<U::Error>,
Returns a stream which transforms the state of this stream into a new future.
fn or_else<F, U>(self, f: F) -> OrElse<Self, F, U> where
Self: Sized,
F: FnMut(Self::Error) -> U,
U: IntoFuture<Item = Self::Item>,
Self: Sized,
F: FnMut(Self::Error) -> U,
U: IntoFuture<Item = Self::Item>,
Returns a stream which transforms errors of this stream into a new future.
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 fold<T, F, Fut, G, Fut2>(
self,
init: T,
next: F,
done: G
) -> Fold<Self, T, F, Fut, G, Fut2> where
Self: Sized,
F: FnMut(T, Self::Item) -> Fut,
Fut: IntoFuture<Item = T>,
Self::Error: From<Fut::Error>,
G: FnOnce(T, Self::State) -> Fut2,
Fut2: IntoFuture<Item = T>,
Self::Error: From<Fut2::Error>,
self,
init: T,
next: F,
done: G
) -> Fold<Self, T, F, Fut, G, Fut2> where
Self: Sized,
F: FnMut(T, Self::Item) -> Fut,
Fut: IntoFuture<Item = T>,
Self::Error: From<Fut::Error>,
G: FnOnce(T, Self::State) -> Fut2,
Fut2: IntoFuture<Item = T>,
Self::Error: From<Fut2::Error>,
Applies a fold across all elements of this stream and its state.
fn skip_while<P, R>(self, pred: P) -> SkipWhile<Self, P, R> where
Self: Sized,
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Self: Sized,
P: FnMut(&Self::Item) -> R,
R: IntoFuture<Item = bool, Error = Self::Error>,
Returns a stream which skips initial elements matching a predicate.
fn for_each<F>(self, f: F) -> ForEach<Self, F> where
Self: Sized,
F: FnMut(Self::Item) -> Result<(), Self::Error>,
Self: Sized,
F: FnMut(Self::Item) -> Result<(), Self::Error>,
Returns a future which applies a closure to each item of this stream.
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: Sized + UnwindSafe,
Self: Sized + UnwindSafe,
Returns a future which catches panics generated by this stream.
fn buffered(self, amt: usize) -> Buffered<Self> where
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>,
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>,
Returns a stream which buffers a fixed number of items of this stream.
fn buffered_unordered(self, amt: usize) -> BufferedUnordered<Self> where
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>,
Self: Sized,
Self::Item: IntoFuture<Error = Self::Error>,
Returns a stream which buffers a fixed number of items of this stream, returning them out of order as they become ready.
Implementors
impl<S: ?Sized> StateStream for Box<S> where
S: StateStream,impl<'a, S: ?Sized> StateStream for &'a mut S where
S: StateStream,impl<S> StateStream for AssertUnwindSafe<S> where
S: StateStream,impl<S> StateStream for FromStream<S> where
S: Stream,impl<S, F, B> StateStream for Map<S, F> where
S: StateStream,
F: FnMut(S::Item) -> B,impl<S, F, B> StateStream for MapErr<S, F> where
S: StateStream,
F: FnMut(S::Error) -> B,impl<S, F, B> StateStream for MapState<S, F> where
S: StateStream,
F: FnOnce(S::State) -> B,impl<T, F, Fut, It, St> StateStream for Unfold<T, F, Fut> where
F: FnMut(T) -> Fut,
Fut: IntoFuture<Item = StreamEvent<(It, T), St>>,impl<F> StateStream for FlattenStateStream<F> where
F: Future,
F::Item: StateStream<Error = F::Error>,impl<S, F> StateStream for Filter<S, F> where
S: StateStream,
F: FnMut(&S::Item) -> bool,impl<S, F, B> StateStream for FilterMap<S, F> where
S: StateStream,
F: FnMut(S::Item) -> Option<B>,impl<S, F, U> StateStream for Then<S, F, U> where
S: StateStream,
F: FnMut(Result<S::Item, S::Error>) -> U,
U: IntoFuture,
S::Error: From<U::Error>,impl<S, F, U> StateStream for AndThen<S, F, U> where
S: StateStream,
F: FnMut(S::Item) -> U,
U: IntoFuture,
S::Error: From<U::Error>,impl<S, F, U> StateStream for AndThenState<S, F, U> where
S: StateStream,
F: FnMut(S::State) -> U,
U: IntoFuture,
S::Error: From<U::Error>,impl<S, F, U> StateStream for OrElse<S, F, U> where
S: StateStream,
F: FnMut(S::Error) -> U,
U: IntoFuture<Item = S::Item>,impl<S, P, R> StateStream for SkipWhile<S, P, R> where
S: StateStream,
P: FnMut(&S::Item) -> R,
R: IntoFuture<Item = bool, Error = S::Error>,impl<S> StateStream for CatchUnwind<S> where
S: StateStream + UnwindSafe,impl<S> StateStream for Buffered<S> where
S: StateStream,
S::Item: IntoFuture<Error = S::Error>,impl<S> StateStream for BufferedUnordered<S> where
S: StateStream,
S::Item: IntoFuture<Error = S::Error>,