pub struct ClosureSink<T> { /* private fields */ }
Expand description
Block acting as Consumer
, which uses a callback as sink
RecvError
s are ignored by this block. Use ContinuousClosureSink
if
you need a guarantee that the received data is complete and without
interruptions.
Implementations
sourceimpl<T> ClosureSink<T>where
T: Clone + Send + Sync + 'static,
impl<T> ClosureSink<T>where
T: Clone + Send + Sync + 'static,
sourcepub fn new<F>(process: F) -> Selfwhere
F: FnMut(T) + Send + 'static,
pub fn new<F>(process: F) -> Selfwhere
F: FnMut(T) + Send + 'static,
Create block which invokes the process
closure for received data
sourcepub fn new_async<F, R>(process: F) -> Selfwhere
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send,
pub fn new_async<F, R>(process: F) -> Selfwhere
F: FnMut(T) -> R + Send + 'static,
R: Future<Output = ()> + Send,
Create block which invokes the process
closure for received data and
await
s its result
This function is the same as ClosureSink::new
but accepts an
asynchronously working closure.
Trait Implementations
sourceimpl<T> Consumer<T> for ClosureSink<T>where
T: Clone,
impl<T> Consumer<T> for ClosureSink<T>where
T: Clone,
sourcefn receiver_connector(&self) -> &ReceiverConnector<T>
fn receiver_connector(&self) -> &ReceiverConnector<T>
Obtain reference to
ReceiverConnector
sourcefn feed_from_none(&self)
fn feed_from_none(&self)
Disconnect
Consumer
from any connected Producer
if connectedsourcefn connect_to_producer<P: Producer<T>>(&self, producer: &P)
fn connect_to_producer<P: Producer<T>>(&self, producer: &P)
👎Deprecated since 0.2.0: method has been renamed to
feed_from
Connect
Consumer
to Producer
sourcefn disconnect_from_producer(&self)
fn disconnect_from_producer(&self)
👎Deprecated since 0.2.0: method has been renamed to
feed_from_none
Disconnect
Consumer
from any connected Producer
if connectedAuto Trait Implementations
impl<T> !RefUnwindSafe for ClosureSink<T>
impl<T> Send for ClosureSink<T>where
T: Send,
impl<T> Sync for ClosureSink<T>where
T: Send,
impl<T> Unpin for ClosureSink<T>
impl<T> !UnwindSafe for ClosureSink<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more