Struct hrsw::Stopwatch [−][src]
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
Auto Trait Implementations
impl RefUnwindSafe for Stopwatch
impl Send for Stopwatch
impl Sync for Stopwatch
impl Unpin for Stopwatch
impl UnwindSafe for Stopwatch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,