Trait ordered_stream::OrderedStreamExt
source · pub trait OrderedStreamExt: OrderedStream {
// Provided methods
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>(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> ⓘ
where Self: Unpin { ... }
fn peekable(self) -> Peekable<Self>
where Self: Sized { ... }
}
Expand description
Helpers for chaining OrderedStream
s.
Provided Methods§
sourcefn map<F, R>(self, f: F) -> Map<Self, F>where
Self: Sized,
F: FnMut(Self::Data) -> R,
fn map<F, R>(self, f: F) -> Map<Self, F>where Self: Sized, F: FnMut(Self::Data) -> R,
Apply a closure to the data.
This does not change the ordering.
sourcefn map_item<F, R>(self, f: F) -> MapItem<Self, F>where
Self: Sized,
F: FnMut(&Self::Ordering, Self::Data) -> R,
fn map_item<F, R>(self, f: F) -> MapItem<Self, F>where Self: Sized, F: FnMut(&Self::Ordering, Self::Data) -> R,
Apply a closure to the items that has access to the ordering data.
sourcefn 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>(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>,
sourcefn then<F, Fut>(self, then: F) -> Then<Self, F, Fut>where
Self: Sized,
F: FnMut(Self::Data) -> Fut,
Fut: Future,
fn then<F, Fut>(self, then: F) -> Then<Self, F, Fut>where Self: Sized, F: FnMut(Self::Data) -> Fut, Fut: Future,
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.
sourcefn 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.
sourcefn 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.
sourcefn 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.
sourcefn next_before<'a>(
&'a mut self,
before: Option<&'a Self::Ordering>
) -> NextBefore<'a, Self> ⓘwhere
Self: Unpin,
fn next_before<'a>( &'a mut self, before: Option<&'a Self::Ordering> ) -> NextBefore<'a, Self> ⓘwhere Self: Unpin,
Return a PollResult
corresponding to the next item in the stream.