Trait ordered_stream::OrderedStreamExt [−][src]
pub trait OrderedStreamExt: OrderedStream {
fn map<F, R>(self, f: F) -> Map<Self, F>
where
Self: Sized,
F: FnMut(Self::Data) -> R,
{ ... }
fn map_item<F, R>(self, f: F) -> MapItem<Self, F>
where
Self: Sized,
F: FnMut(&Self::Ordering, Self::Data) -> R,
{ ... }
fn map_ordering<NewOrdering, NewData, MapInto, MapFrom>(
self,
map_into: MapInto,
map_from: MapFrom
) -> MapOrdering<Self, MapInto, MapFrom>
where
Self: Sized,
MapInto: FnMut(Self::Ordering, Self::Data) -> (NewOrdering, NewData),
MapFrom: FnMut(&NewOrdering) -> Option<Self::Ordering>,
NewOrdering: Ord,
{ ... }
fn filter<F, R>(self, filter: F) -> Filter<Self, F>
where
Self: Sized,
F: FnMut(&Self::Data) -> bool,
{ ... }
fn filter_map<F, R>(self, filter: F) -> FilterMap<Self, F>
where
Self: Sized,
F: FnMut(Self::Data) -> Option<R>,
{ ... }
fn then<F, Fut>(self, then: F) -> Then<Self, F, Fut>
where
Self: Sized,
F: FnMut(Self::Data) -> Fut,
Fut: Future,
{ ... }
fn into_stream(self) -> IntoStream<Self>
where
Self: Sized,
{ ... }
fn into_tuple_stream(self) -> IntoTupleStream<Self>
where
Self: Sized,
{ ... }
fn into_ordering(self) -> IntoOrdering<Self>
where
Self: Sized,
{ ... }
fn next(&mut self) -> Next<'_, Self>ⓘ
where
Self: Unpin,
{ ... }
fn next_before<'a>(
&'a mut self,
before: Option<&'a Self::Ordering>
) -> NextBefore<'a, Self>ⓘNotable traits for NextBefore<'a, S>impl<'a, S> Future for NextBefore<'a, S> where
S: OrderedStream + ?Sized, type Output = PollResult<S::Ordering, S::Data>;
where
Self: Unpin,
{ ... }
}
Expand description
Helpers for chaining OrderedStream
s.
Provided methods
Apply a closure to the data.
This does not change the ordering.
Apply a closure to the items that has access to the ordering data.
fn map_ordering<NewOrdering, NewData, MapInto, MapFrom>(
self,
map_into: MapInto,
map_from: MapFrom
) -> MapOrdering<Self, MapInto, MapFrom> where
Self: Sized,
MapInto: FnMut(Self::Ordering, Self::Data) -> (NewOrdering, NewData),
MapFrom: FnMut(&NewOrdering) -> Option<Self::Ordering>,
NewOrdering: Ord,
fn map_ordering<NewOrdering, NewData, MapInto, MapFrom>(
self,
map_into: MapInto,
map_from: MapFrom
) -> MapOrdering<Self, MapInto, MapFrom> where
Self: Sized,
MapInto: FnMut(Self::Ordering, Self::Data) -> (NewOrdering, NewData),
MapFrom: FnMut(&NewOrdering) -> Option<Self::Ordering>,
NewOrdering: Ord,
Apply a closure to the items that can change the type of the ordering value.
A bidirectional mapping for ordering values is required in order to remap before
values.
It is the caller’s responsibility to ensure that the items in the mapped stream still meet
the ordering requirements that OrderedStream
expects.
fn filter<F, R>(self, filter: F) -> Filter<Self, F> where
Self: Sized,
F: FnMut(&Self::Data) -> bool,
fn filter_map<F, R>(self, filter: F) -> FilterMap<Self, F> where
Self: Sized,
F: FnMut(Self::Data) -> Option<R>,
Apply a closure that produces a Future
to items, running the future on each item in
sequence before processing the next.
This has the side effect of buffering items that are not before the requested ordering
point; you can use ready
as the closure to take advantage of this
behavior if you don’t want to buffer items yourself.
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
fn into_stream(self) -> IntoStream<Self> where
Self: Sized,
Convert this into a Stream
, discarding the ordering information.
fn into_tuple_stream(self) -> IntoTupleStream<Self> where
Self: Sized,
fn into_tuple_stream(self) -> IntoTupleStream<Self> where
Self: Sized,
Convert this into a Stream
, keeping the ordering objects.
fn into_ordering(self) -> IntoOrdering<Self> where
Self: Sized,
fn into_ordering(self) -> IntoOrdering<Self> where
Self: Sized,
Convert this into a Stream
, keeping only the ordering objects.
Return the next item in this stream.
fn next_before<'a>(
&'a mut self,
before: Option<&'a Self::Ordering>
) -> NextBefore<'a, Self>ⓘNotable traits for NextBefore<'a, S>impl<'a, S> Future for NextBefore<'a, S> where
S: OrderedStream + ?Sized, type Output = PollResult<S::Ordering, S::Data>;
where
Self: Unpin,
fn next_before<'a>(
&'a mut self,
before: Option<&'a Self::Ordering>
) -> NextBefore<'a, Self>ⓘNotable traits for NextBefore<'a, S>impl<'a, S> Future for NextBefore<'a, S> where
S: OrderedStream + ?Sized, type Output = PollResult<S::Ordering, S::Data>;
where
Self: Unpin,
impl<'a, S> Future for NextBefore<'a, S> where
S: OrderedStream + ?Sized, type Output = PollResult<S::Ordering, S::Data>;
Return a PollResult
corresponding to the next item in the stream.