OutputTracker

Struct OutputTracker 

Source
pub struct OutputTracker<M> { /* private fields */ }
Expand description

A struct that collects state data or action data of any kind.

This is the threadsafe variant.

The tracked data can be read any time and as often as needed by calling the output(). Each time the output is read, all data collected so far are returned. To track only new data emitted after the last read of the output, the clear() function should be called.

The tracker can be deactivated by calling the stop() function to stop it from collecting data. Once stopped the tracker can not be activated again.

Implementations§

Source§

impl<M> OutputTracker<M>

Source

pub fn stop(&self) -> Result<(), Error>

Stops this tracker.

After stopping a tracker it no longer tracks emitted data. Once a tracker is stopped it can not be activated again.

Source

pub fn clear(&self) -> Result<(), Error>

Clears the data this tracker has been collected so far.

After clearing a tracker it still tracks any data which is emitted after this clear function has been called.

Source

pub fn output(&self) -> Result<Vec<M>, Error>
where M: Clone,

Returns the data collected by this tracker so far.

Each time this function is called it returns all data collected since the tracker has been created or since the last call to of the clear() function. To track only data that are emitted after the last time the output was read, the clear() should be called after the output has been read.

Trait Implementations§

Source§

impl<M: Debug> Debug for OutputTracker<M>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> Freeze for OutputTracker<M>

§

impl<M> RefUnwindSafe for OutputTracker<M>

§

impl<M> Send for OutputTracker<M>
where M: Send,

§

impl<M> Sync for OutputTracker<M>
where M: Send,

§

impl<M> Unpin for OutputTracker<M>

§

impl<M> UnwindSafe for OutputTracker<M>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.