Struct Fanout

#[must_use = "sinks do nothing unless polled"]
pub struct Fanout<Si1, Si2> { /* private fields */ }

Sink that clones incoming items and forwards them to two sinks at the same time.

Backpressure from any downstream sink propagates up, which means that this sink can only process items as fast as its slowest downstream sink.

Implementations

impl<Si1, Si2> Fanout<Si1, Si2>

fn get_ref(&self) -> (&Si1, &Si2)

Get a shared reference to the inner sinks.

fn get_mut(&mut self) -> (&mut Si1, &mut Si2)

Get a mutable reference to the inner sinks.

fn get_pin_mut(self: Pin<&mut Self>) -> (Pin<&mut Si1>, Pin<&mut Si2>)

Get a pinned mutable reference to the inner sinks.

fn into_inner(self) -> (Si1, Si2)

Consumes this combinator, returning the underlying sinks.

Note that this may discard intermediate state of this combinator, so care should be taken to avoid losing resources when this is called.

Trait Implementations

impl<'__pin, Si1, Si2> Unpin for Fanout<Si1, Si2> where PinnedFieldsOf<__Origin<'__pin, Si1, Si2>>: Unpin,

impl<Si1, Si2, Item> Sink<Item> for Fanout<Si1, Si2> where Si1: Sink<Item>, Item: Clone, Si2: Sink<Item, Error = Si1::Error>,

type Error = <Si1 as Sink<Item>>::Error;
fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, item: Item) -> Result<(), Self::Error>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

impl<Si1: Debug, Si2: Debug> Debug for Fanout<Si1, Si2>

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Auto Trait Implementations

impl<Si1, Si2> Freeze for Fanout<Si1, Si2> where Si1: Freeze, Si2: Freeze,

impl<Si1, Si2> RefUnwindSafe for Fanout<Si1, Si2> where Si1: RefUnwindSafe, Si2: RefUnwindSafe,

impl<Si1, Si2> Send for Fanout<Si1, Si2> where Si1: Send, Si2: Send,

impl<Si1, Si2> Sync for Fanout<Si1, Si2> where Si1: Sync, Si2: Sync,

impl<Si1, Si2> UnsafeUnpin for Fanout<Si1, Si2> where Si1: UnsafeUnpin, Si2: UnsafeUnpin,

impl<Si1, Si2> UnwindSafe for Fanout<Si1, Si2> where Si1: UnwindSafe, Si2: UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Fanout<Si1, Si2> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Fanout<Si1, Si2> where T: ?Sized,

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

impl<T> From<T> for Fanout<Si1, Si2>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, Item> SinkExt<Item> for Fanout<Si1, Si2> where T: Sink<Item> + ?Sized,

impl<T, U> Into<U> for Fanout<Si1, Si2> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for Fanout<Si1, Si2> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Fanout<Si1, Si2> where U: TryFrom<T>,

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