Struct TimerSet

Source
pub struct TimerSet<Key: Eq + Hash + Clone, T: Tracker, S: Source> { /* private fields */ }
Expand description

A timer set tracks a collection of timers, of which at most one can be running at any given time.

Implementations§

Source§

impl<Key, T, S> TimerSet<Key, T, S>
where Key: Eq + Hash + Clone, T: Tracker, S: Source,

Source

pub fn new() -> Self

Create a new TimerSet with no currently running timer.

Source

pub fn start(&mut self, k: Key)

Starts a specific timer, stopping the currently running timer (if any).

Source

pub fn stop(&mut self)

Stops the currently running timer without starting any others.

Source

pub fn is_running(&self) -> bool

Returns whether the timer is currently running.

Source

pub fn get_stats(&self, k: Key) -> Option<T::Statistics>

Source

pub fn num_nanoseconds(&self, k: Key) -> Option<u64>

Returns the elapsed time in nanoseconds.

Source

pub fn num_microseconds(&self, k: Key) -> Option<u64>

Returns the elapsed time in microseconds.

Source

pub fn num_milliseconds(&self, k: Key) -> Option<u64>

Return the elapsed time in milliseconds.

Source

pub fn num_seconds(&self, k: Key) -> Option<u64>

Returns the elapsed time in seconds.

Source

pub fn num_minutes(&self, k: Key) -> Option<u64>

Returns the elapsed time in minutes.

Source

pub fn num_hours(&self, k: Key) -> Option<u64>

Returns the elapsed time in hours.

Auto Trait Implementations§

§

impl<Key, T, S> Freeze for TimerSet<Key, T, S>
where S: Freeze, Key: Freeze,

§

impl<Key, T, S> RefUnwindSafe for TimerSet<Key, T, S>

§

impl<Key, T, S> Send for TimerSet<Key, T, S>
where S: Send, Key: Send, T: Send,

§

impl<Key, T, S> Sync for TimerSet<Key, T, S>
where S: Sync, Key: Sync, T: Sync,

§

impl<Key, T, S> Unpin for TimerSet<Key, T, S>
where S: Unpin, Key: Unpin, T: Unpin,

§

impl<Key, T, S> UnwindSafe for TimerSet<Key, T, S>
where S: UnwindSafe, Key: UnwindSafe, T: UnwindSafe,

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.