pub trait SinkBuild {
type Item;
type Output<Next: Sink<Self::Item>>;
Show 13 methods
// Required method
fn send_to<Next>(self, next: Next) -> Self::Output<Next>
where Next: Sink<Self::Item>;
// Provided methods
fn fanout<Si0, Si1>(
self,
sink0: Si0,
sink1: Si1,
) -> Self::Output<Fanout<Si0, Si1>>
where Self: Sized,
Self::Item: Clone,
Si0: Sink<Self::Item>,
Si1: Sink<Self::Item, Error = Si0::Error> { ... }
fn for_each<Func>(self, func: Func) -> Self::Output<ForEach<Func>>
where Self: Sized,
Func: FnMut(Self::Item) { ... }
fn try_for_each<Func, Error>(
self,
func: Func,
) -> Self::Output<TryForEach<Func>>
where Self: Sized,
Func: FnMut(Self::Item) -> Result<(), Error> { ... }
fn map<Func, Out>(self, func: Func) -> MapBuilder<Self, Func>
where Self: Sized,
Func: FnMut(Self::Item) -> Out { ... }
fn filter<Func>(self, func: Func) -> FilterBuilder<Self, Func>
where Self: Sized,
Func: FnMut(&Self::Item) -> bool { ... }
fn filter_map<Func, Out>(self, func: Func) -> FilterMapBuilder<Self, Func>
where Self: Sized,
Func: FnMut(Self::Item) -> Option<Out> { ... }
fn flat_map<Func, IntoIter>(self, func: Func) -> FlatMapBuilder<Self, Func>
where Self: Sized,
Func: FnMut(Self::Item) -> IntoIter,
IntoIter: IntoIterator { ... }
fn flatten<IntoIter>(self) -> FlattenBuilder<Self>
where Self: Sized,
Self::Item: IntoIterator { ... }
fn inspect<Func>(self, func: Func) -> InspectBuilder<Self, Func>
where Self: Sized,
Func: FnMut(&Self::Item) { ... }
fn unzip<Si0, Si1, Item0, Item1>(
self,
sink0: Si0,
sink1: Si1,
) -> Self::Output<Unzip<Si0, Si1>>
where Self: Sized + SinkBuild<Item = (Item0, Item1)>,
Si0: Sink<Item0>,
Si1: Sink<Item1>,
Si0::Error: From<Si1::Error> { ... }
fn demux_map<Key, ItemVal, Si>(
self,
sinks: impl Into<HashMap<Key, Si>>,
) -> Self::Output<DemuxMap<Key, Si>>
where Self: Sized + SinkBuild<Item = (Key, ItemVal)>,
Key: Eq + Hash + Debug + Unpin,
Si: Sink<ItemVal> + Unpin { ... }
fn demux_var<Sinks, ItemVal, Error>(
self,
sinks: Sinks,
) -> Self::Output<DemuxVar<Sinks, Error>>
where Self: Sized + SinkBuild<Item = (usize, ItemVal)>,
Sinks: SinkVariadic<ItemVal, Error> { ... }
}
Expand description
A helper trait for building Sink
s in forward order, unlike with Sinktools
.
To start a sink adaptor chain, use SinkBuilder
.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn fanout<Si0, Si1>(
self,
sink0: Si0,
sink1: Si1,
) -> Self::Output<Fanout<Si0, Si1>>
fn fanout<Si0, Si1>( self, sink0: Si0, sink1: Si1, ) -> Self::Output<Fanout<Si0, Si1>>
Clone each item and send to both sink0
and sink1
, completing this sink adaptor chain.
Sourcefn for_each<Func>(self, func: Func) -> Self::Output<ForEach<Func>>
fn for_each<Func>(self, func: Func) -> Self::Output<ForEach<Func>>
Appends a function which consumes each element, completing this sink adaptor chain.
Sourcefn try_for_each<Func, Error>(self, func: Func) -> Self::Output<TryForEach<Func>>
fn try_for_each<Func, Error>(self, func: Func) -> Self::Output<TryForEach<Func>>
Appends a function which consumes each element and returns a result, completing this sink adaptor chain.
Sourcefn map<Func, Out>(self, func: Func) -> MapBuilder<Self, Func>
fn map<Func, Out>(self, func: Func) -> MapBuilder<Self, Func>
Appends a function which is called on each element and pases along each output.
Sourcefn filter<Func>(self, func: Func) -> FilterBuilder<Self, Func>
fn filter<Func>(self, func: Func) -> FilterBuilder<Self, Func>
Appends a predicate function which filters items.
Sourcefn filter_map<Func, Out>(self, func: Func) -> FilterMapBuilder<Self, Func>
fn filter_map<Func, Out>(self, func: Func) -> FilterMapBuilder<Self, Func>
Appends a function which both filters and maps items.
Sourcefn flat_map<Func, IntoIter>(self, func: Func) -> FlatMapBuilder<Self, Func>
fn flat_map<Func, IntoIter>(self, func: Func) -> FlatMapBuilder<Self, Func>
Appends a function which maps each item to an iterator and flattens the results.
Sourcefn flatten<IntoIter>(self) -> FlattenBuilder<Self>
fn flatten<IntoIter>(self) -> FlattenBuilder<Self>
Flattens items that are iterators.
Sourcefn inspect<Func>(self, func: Func) -> InspectBuilder<Self, Func>
fn inspect<Func>(self, func: Func) -> InspectBuilder<Self, Func>
Appends a function which inspects each item without modifying it.
Sourcefn unzip<Si0, Si1, Item0, Item1>(
self,
sink0: Si0,
sink1: Si1,
) -> Self::Output<Unzip<Si0, Si1>>
fn unzip<Si0, Si1, Item0, Item1>( self, sink0: Si0, sink1: Si1, ) -> Self::Output<Unzip<Si0, Si1>>
Splits items into two sinks based on tuple structure.
Sourcefn demux_map<Key, ItemVal, Si>(
self,
sinks: impl Into<HashMap<Key, Si>>,
) -> Self::Output<DemuxMap<Key, Si>>
Available on crate feature std
only.
fn demux_map<Key, ItemVal, Si>( self, sinks: impl Into<HashMap<Key, Si>>, ) -> Self::Output<DemuxMap<Key, Si>>
std
only.Sends each item into one sink depending on the key, where the sinks are in a HashMap
.
This requires sinks Si
to be Unpin
. If your sinks are not Unpin
, first wrap them in Box::pin
to make them Unpin
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.