pub trait DurationCalibration<D> {
// Required methods
fn convert_to_ns(&self, d: D) -> u64;
fn convert_from_ns(&self, ns: u64) -> D;
// Provided methods
fn to_std(&self, d: D) -> Duration
where Self: Sized { ... }
fn convert_from_std(&self, d: Duration) -> D
where Self: Sized { ... }
}Expand description
Converts a clock’s native duration type to and from nanoseconds.
Required Methods§
Sourcefn convert_to_ns(&self, d: D) -> u64
fn convert_to_ns(&self, d: D) -> u64
Converts a duration to nanoseconds, rounding to the nearest nanosecond.
Sourcefn convert_from_ns(&self, ns: u64) -> D
fn convert_from_ns(&self, ns: u64) -> D
Converts a nanosecond value to this clock’s native duration type.
Provided Methods§
fn to_std(&self, d: D) -> Durationwhere
Self: Sized,
fn convert_from_std(&self, d: Duration) -> Dwhere
Self: Sized,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".