Struct floating_duration::TimeFormat
[−]
[src]
pub struct TimeFormat<T: Borrow<Duration>>(pub T);
A formatting newtype for providing a
Display implementation. This format is
meant to be used for printing performance measurements.
Behaviour
secs > 0=> seconds with precision 3secs > 0.001=> milliseconds with precision 3secs > 0.000_001=> microseconds with precision 3- otherwise => nanoseconds
Examples
use std::time::Duration; use floating_duration::TimeFormat; let dur = Duration::new(0, 461_933); let formatted = format!("{}", TimeFormat(dur)); assert_eq!(formatted, "461.933 microseconds");
Trait Implementations
impl<T: Clone + Borrow<Duration>> Clone for TimeFormat<T>[src]
fn clone(&self) -> TimeFormat<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more