[−][src]Struct simple_stopwatch::Stopwatch
Simple stopwatch
Methods
impl Stopwatch
[src]
pub fn start_new() -> Stopwatch
[src]
Create new stopwatch and start timing
pub fn restart(&mut self)
[src]
Restart timing from current time
Examples
use simple_stopwatch::Stopwatch; use std::time::Duration; fn main() { let mut sw = Stopwatch::start_new(); // emulate some work std::thread::sleep(Duration::from_millis(1000)); sw.restart(); let ms = sw.ms(); assert!( ms < 1f32, "After restart, timer value is small" ); }
pub fn s(&self) -> f32
[src]
Get elapsed time since creation/restart in seconds
pub fn ms(&self) -> f32
[src]
Get elapsed time since creation/restart in milliseconds
Examples
use simple_stopwatch::Stopwatch; use std::time::Duration; fn main() { let mut sw = Stopwatch::start_new(); // emulate some work std::thread::sleep(Duration::from_millis(10)); // measure elapsed time let ms = sw.ms(); assert!( ms >= 10f32 ); }
pub fn us(&self) -> f32
[src]
Get elapsed time since creation/restart in microseconds
pub fn ns(&self) -> f32
[src]
Get elapsed time since creation/restart in nanoseconds
Trait Implementations
Auto Trait Implementations
impl Send for Stopwatch
impl Unpin for Stopwatch
impl Sync for Stopwatch
impl UnwindSafe for Stopwatch
impl RefUnwindSafe for Stopwatch
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,