Skip to main content

U64Calibration

Struct U64Calibration 

Source
pub struct U64Calibration { /* private fields */ }
Expand description

Integer multiply-shift calibration for WrappingU64Duration.

Converts between raw ticks and nanoseconds using precomputed multiply-shift factors.

Implementations§

Source§

impl U64Calibration

Source

pub fn new(duration: WrappingU64Duration, duration_ns: u64) -> Self

Creates a calibration from a measured duration and its nanosecond equivalent.

Source

pub fn new_with_reference_clock<C: Clock<Time = WrappingU64Time>, R: Clock>( clock: &C, reference_clock: &CalibratedClock<R>, min_duration: <R::Time as Time>::Duration, wait: impl FnMut(<R::Time as Time>::Instant), ) -> (Self, ClockSynchronization<R::Time, C::Time>)

Calibrates clock against reference_clock, calling wait until min_duration elapses.

Returns the calibration and a ClockSynchronization relating the two clocks to each other wait is invoked with the instant until which it should wait.

Source

pub fn new_with_std_instant<C: Clock<Time = WrappingU64Time>>( clock: &C, min_duration: Duration, ) -> (Self, ClockSynchronization<InstantTime, C::Time>)

Calibrates clock against std::time::Instant, sleeping for at least min_duration.

This is a convenience wrapper around U64Calibration::new_with_reference_clock based on std::time::Instant and std::thread::sleep.

Trait Implementations§

Source§

impl Clone for U64Calibration

Source§

fn clone(&self) -> U64Calibration

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for U64Calibration

Source§

impl Debug for U64Calibration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DurationCalibration<WrappingU64Duration> for U64Calibration

Source§

fn convert_to_ns(&self, d: WrappingU64Duration) -> u64

Converts a duration to nanoseconds, rounding to the nearest nanosecond.
Source§

fn convert_from_ns(&self, ns: u64) -> WrappingU64Duration

Converts a nanosecond value to this clock’s native duration type.
Source§

fn to_std(&self, d: D) -> Duration
where Self: Sized,

Source§

fn convert_from_std(&self, d: Duration) -> D
where Self: Sized,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.