Struct hrsw::Stopwatch[][src]

pub struct Stopwatch { /* fields omitted */ }

Implementations

impl Stopwatch[src]

pub fn new() -> Stopwatch[src]

Creates a Stopwatch.

pub fn new_started() -> Stopwatch[src]

Creates and immediately starts a Stopwatch.

pub fn start(&mut self)[src]

Starts the measurement. If the stopwatch is already running, then the call has no effect.

pub fn stop(&mut self)[src]

Stops the measurement. The elapsed duration can be obtained using elapsed(). If the stopwatch has never been started or has already been stopped, then the call has no effect.

pub fn reset(&mut self)[src]

Restores the original state of the stopwatch. If the stopwatch is running, then it will be stopped and the elapsed will be cleared, so it can’t be obtained.

pub fn reset_and_start(&mut self)[src]

Restores the original state of the stopwatch and then starts the measurement. It is the same as calling reset() and start() in that sequence.

pub fn elapsed(&self) -> Duration[src]

Returns the elapsed time. In case of multiple start() and stop() the elapsed intervals are accumulated. The elapsed time can be cleared by reset() or reset_and_start()`.

pub fn is_running(&self) -> bool[src]

Returns whether the stopwatch is running or not.

Trait Implementations

impl Clone for Stopwatch[src]

impl Copy for Stopwatch[src]

impl Debug for Stopwatch[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.