Skip to main content

TestTracker

Struct TestTracker 

Source
pub struct TestTracker { /* private fields */ }
Expand description

A tracker that keeps track events.

Implementations§

Source§

impl TestTracker

Source

pub fn new(initial_id: u64, level: Level) -> Self

Create a new Tracker for the tests.

This keeps the track events in memory for checking later.

Source

pub fn events(&self) -> Vec<String>

Return a snapshot of the events recorded so far.

Trait Implementations§

Source§

impl Track for TestTracker

Source§

fn unique_id(&self) -> Id

Allocate a new global ID
Source§

fn enabled_level(&self, _id: Id) -> Level

Determine the most verbose tracking level enabled for an entity.
Source§

fn monitoring_window_size_for(&self, _id: Id) -> Option<u64>

Return the monitoring window size if it is to be enabled. Entity looked up by its ID.
Source§

fn add_entity( &self, _id: Id, _entity_name: &str, _alternative_names: AlternativeNames<'_>, ) -> Level

Record an entity being created.
Source§

fn enter(&self, id: Id, item: Id)

Track when an entity with the given ID arrives.
Source§

fn exit(&self, id: Id, item: Id)

Track when an entity with the given ID leaves.
Source§

fn value(&self, id: Id, value: f64)

Track an entity setting a value.
Source§

fn begin_activity(&self, activity: Id, lane: Id, name: &str)

Track the beginning of a named activity on a lane.
Source§

fn end_activity(&self, activity: Id)

Track the end of the current activity on a lane.
Source§

fn add_to_group(&self, activity: Id, group_id: Id)

Track when an activity becomes a member of a group.
Source§

fn remove_from_group(&self, activity: Id, group_id: Id)

Track when an activity is no longer a member of a group.
Source§

fn create_entity(&self, created_by: Id, id: Id, name: &str)

Track when an entity with the given ID is created.
Source§

fn create_monitor(&self, created_by: Id, id: Id, name: &str)

Track when a monitor with the given ID is created.
Source§

fn create_lane(&self, created_by: Id, id: Id, name: &str)

Track when a lane with the given ID is created.
Source§

fn create_group(&self, created_by: Id, id: Id, name: &str)

Track when a group with the given ID is created.
Source§

fn create_object( &self, created_by: Id, id: Id, size: usize, units: &str, req_type: u8, details: &str, )

Track when an object with the given ID is created.
Source§

fn capacity(&self, id: Id, capacity: Capacity)

Track the capacity available in an entity.
Source§

fn destroy(&self, destroyed_by: Id, id: Id)

Track when an entity with the given ID is destroyed.
Source§

fn connect(&self, connect_from: Id, connect_to: Id)

Track when an entity is connected to another entity
Source§

fn log(&self, id: Id, level: Level, msg: Arguments<'_>)

Track a log message of the given level.
Source§

fn time(&self, set_by: Id, time_ns: f64)

Advance the time to the time specified in ns.
Source§

fn shutdown(&self)

Perform any pre-exit shutdown/cleanup
Source§

fn is_entity_enabled(&self, id: Id, level: Level) -> bool

Determine whether tracking is enabled at a given level for an entity.

Auto Trait Implementations§

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.