SinkBuilder

Struct SinkBuilder 

Source
pub struct SinkBuilder<Item>(/* private fields */);
Expand description

Start a SinkBuild adaptor chain, with Item as the input item type.

Implementations§

Source§

impl<Item> SinkBuilder<Item>

Source

pub fn new() -> Self

Create a new sink builder.

Trait Implementations§

Source§

impl<Item> Default for SinkBuilder<Item>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Item> SinkBuild for SinkBuilder<Item>

Source§

type Item = Item

The output item type.
Source§

type Output<Next: Sink<Self::Item>> = Next

The output Sink type, if it is prepended to Next.
Source§

fn send_to<Next>(self, next: Next) -> Self::Output<Next>
where Next: Sink<Self::Item>,

Complete this sink adaptor chain by connecting it to next as the output. Read more
Source§

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>,

Clone each item and send to both sink0 and sink1, completing this sink adaptor chain.
Source§

fn for_each<Func>(self, func: Func) -> Self::Output<ForEach<Func>>
where Self: Sized, Func: FnMut(Self::Item),

Appends a function which consumes each element, completing this sink adaptor chain.
Source§

fn try_for_each<Func, Error>(self, func: Func) -> Self::Output<TryForEach<Func>>
where Self: Sized, Func: FnMut(Self::Item) -> Result<(), Error>,

Appends a function which consumes each element and returns a result, completing this sink adaptor chain.
Source§

fn map<Func, Out>(self, func: Func) -> MapBuilder<Self, Func>
where Self: Sized, Func: FnMut(Self::Item) -> Out,

Appends a function which is called on each element and pases along each output.
Source§

fn filter<Func>(self, func: Func) -> FilterBuilder<Self, Func>
where Self: Sized, Func: FnMut(&Self::Item) -> bool,

Appends a predicate function which filters items.
Source§

fn filter_map<Func, Out>(self, func: Func) -> FilterMapBuilder<Self, Func>
where Self: Sized, Func: FnMut(Self::Item) -> Option<Out>,

Appends a function which both filters and maps items.
Source§

fn flat_map<Func, IntoIter>(self, func: Func) -> FlatMapBuilder<Self, Func>
where Self: Sized, Func: FnMut(Self::Item) -> IntoIter, IntoIter: IntoIterator,

Appends a function which maps each item to an iterator and flattens the results.
Source§

fn flatten<IntoIter>(self) -> FlattenBuilder<Self>
where Self: Sized, Self::Item: IntoIterator,

Flattens items that are iterators.
Source§

fn inspect<Func>(self, func: Func) -> InspectBuilder<Self, Func>
where Self: Sized, Func: FnMut(&Self::Item),

Appends a function which inspects each item without modifying it.
Source§

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>,

Splits items into two sinks based on tuple structure.
Source§

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,

Available on crate feature std only.
Sends each item into one sink depending on the key, where the sinks are in a HashMap. Read more
Source§

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>,

Available on crate feature variadics only.
Sends each item into one sink depending on the index, where the sinks are a variadic.

Auto Trait Implementations§

§

impl<Item> Freeze for SinkBuilder<Item>

§

impl<Item> RefUnwindSafe for SinkBuilder<Item>

§

impl<Item> Send for SinkBuilder<Item>

§

impl<Item> Sync for SinkBuilder<Item>

§

impl<Item> Unpin for SinkBuilder<Item>

§

impl<Item> UnwindSafe for SinkBuilder<Item>

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> ToSinkBuild for T

Source§

fn iter_to_sink_build(self) -> SendIterBuild<Self>
where Self: Sized + Iterator,

Starts a SinkBuild adaptor chain to send all items from self as an Iterator.
Source§

fn stream_to_sink_build(self) -> SendStreamBuild<Self>
where Self: Sized + Stream,

Starts a SinkBuild adaptor chain to send all items from self as a [Stream].
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.