pub struct Source<T: Send + Default> { /* private fields */ }
Implementations§
source§impl<T> Source<T>
impl<T> Source<T>
sourcepub fn send(&mut self, data: &T) -> State
pub fn send(&mut self, data: &T) -> State
Modify the current data and publish the changes to the sinks. The data will be cloned once.
sourcepub fn modify(&mut self, closure: &mut dyn FnMut(&mut T)) -> State
pub fn modify(&mut self, closure: &mut dyn FnMut(&mut T)) -> State
Modify the current data with zero copy and publish the changes to the sinks.
sourcepub fn access(&mut self, closure: &mut dyn FnMut(&mut T))
pub fn access(&mut self, closure: &mut dyn FnMut(&mut T))
Access the current data without publishing the change to the sinks.
sourcepub fn sink_count(&self) -> u32
pub fn sink_count(&self) -> u32
Returns the number of current sinks connected to the source.
Auto Trait Implementations§
impl<T> RefUnwindSafe for Source<T>where
T: RefUnwindSafe,
impl<T> Send for Source<T>
impl<T> Sync for Source<T>where
T: Sync,
impl<T> Unpin for Source<T>
impl<T> UnwindSafe for Source<T>where
T: UnwindSafe + 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