pub struct OutputSubject<M> { /* private fields */ }Expand description
Holds created OutputTrackers and emits data to all known trackers.
This is the non-threadsafe variant.
New OutputTrackers can be created by calling the
create_tracker() function.
The emit(data) function emits data to all trackers,
that have been created for this subject and are not stopped yet.
Implementations§
Source§impl<M> OutputSubject<M>
impl<M> OutputSubject<M>
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new OutputSubject.
A new subject does nothing unless one or more trackers have been created.
Source§impl<M> OutputSubject<M>where
M: Clone,
impl<M> OutputSubject<M>where
M: Clone,
Sourcepub fn create_tracker(&self) -> Result<OutputTracker<M>, Error>
pub fn create_tracker(&self) -> Result<OutputTracker<M>, Error>
Creates a new OutputTracker and registers it to be ready to track
emitted data.
Sourcepub fn emit(&self, data: M) -> Result<(), Error>
pub fn emit(&self, data: M) -> Result<(), Error>
Emits given data to all active OutputTrackers.
Stopped OutputTrackers do not receive any emitted data.
Trait Implementations§
Source§impl<M: Clone> Clone for OutputSubject<M>
impl<M: Clone> Clone for OutputSubject<M>
Source§fn clone(&self) -> OutputSubject<M>
fn clone(&self) -> OutputSubject<M>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<M: Debug> Debug for OutputSubject<M>
impl<M: Debug> Debug for OutputSubject<M>
Source§impl<M: Default> Default for OutputSubject<M>
impl<M: Default> Default for OutputSubject<M>
Source§fn default() -> OutputSubject<M>
fn default() -> OutputSubject<M>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<M> Freeze for OutputSubject<M>
impl<M> !RefUnwindSafe for OutputSubject<M>
impl<M> !Send for OutputSubject<M>
impl<M> !Sync for OutputSubject<M>
impl<M> Unpin for OutputSubject<M>
impl<M> !UnwindSafe for OutputSubject<M>
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