pub struct Sink<T>{ /* private fields */ }
Implementations§
source§impl<T> Sink<T>
impl<T> Sink<T>
sourcepub fn from(source: &Source<T>) -> Self
pub fn from(source: &Source<T>) -> Self
Creates a new Sink from the given Source. This is the only way to create a Sink. That’s necessary to guaranty that both share the same sync property.
sourcepub fn receive(&self) -> T
pub fn receive(&self) -> T
Returns a copy of the received signal value. This is especially useful for small or primitive types. If the signal data is to expansive to copy have a look at [process].
sourcepub fn process(&self, closure: &mut dyn FnMut(&T))
pub fn process(&self, closure: &mut dyn FnMut(&T))
In contrast to [receive] this function allows the consumer to directly access the data via an immutable reference given by a closure. This could drastically reduce memory usage, but creates back pressure onto the sender if processing takes to much time (even if not synced).
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Sink<T>where
T: RefUnwindSafe,
impl<T> Send for Sink<T>
impl<T> Sync for Sink<T>
impl<T> Unpin for Sink<T>
impl<T> UnwindSafe for Sink<T>where
T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more