Skip to main content

MapState

Struct MapState 

Source
pub struct MapState<S, F> { /* private fields */ }
Expand description

A stream which applies a transform to the state of a stream.

Trait Implementations§

Source§

impl<S, F, B> StateStream for MapState<S, F>
where S: StateStream, F: FnOnce(S::State) -> B,

Source§

type Item = <S as StateStream>::Item

The items being streamed.
Source§

type State = B

The state returned when streaming completes.
Source§

type Error = <S as StateStream>::Error

The error returned.
Source§

fn poll(&mut self) -> Poll<StreamEvent<S::Item, B>, (S::Error, B)>

Similar to Stream::poll. Read more
Source§

fn into_future(self) -> IntoFuture<Self>
where Self: Sized,

Returns a future which yields the next element of the stream.
Source§

fn into_stream(self) -> IntoStream<Self>
where Self: Sized,

Returns a normal Stream which yields the elements of this stream and discards the state.
Source§

fn map<F, B>(self, f: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> B,

Returns a stream which applies a transform to items of this stream.
Source§

fn map_err<F, B>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Self::Error) -> B,

Returns a stream which applies a transform to errors of this stream.
Source§

fn map_state<F, B>(self, f: F) -> MapState<Self, F>
where Self: Sized, F: FnOnce(Self::State) -> B,

Returns a stream which applies a transform to the state of this stream.
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where Self: Sized, F: FnMut(&Self::Item) -> bool,

Returns a stream which filters items of this stream by a predicate.
Source§

fn filter_map<F, B>(self, f: F) -> FilterMap<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> Option<B>,

Returns a stream which filters and transforms items of this stream by a predicate.
Source§

fn collect(self) -> Collect<Self>
where Self: Sized,

Returns a stream which collects all items of this stream into a Vec, returning it along with the stream’s state.
Source§

fn for_each<F>(self, f: F) -> ForEach<Self, F>
where Self: Sized, F: FnMut(Self::Item),

Returns a future which applies a closure to each item of this stream.

Auto Trait Implementations§

§

impl<S, F> Freeze for MapState<S, F>
where S: Freeze, Option<F>: Freeze,

§

impl<S, F> RefUnwindSafe for MapState<S, F>

§

impl<S, F> Send for MapState<S, F>
where S: Send, Option<F>: Send,

§

impl<S, F> Sync for MapState<S, F>
where S: Sync, Option<F>: Sync,

§

impl<S, F> Unpin for MapState<S, F>
where S: Unpin, Option<F>: Unpin,

§

impl<S, F> UnsafeUnpin for MapState<S, F>

§

impl<S, F> UnwindSafe for MapState<S, F>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.