Skip to main content

ClockSynchronization

Struct ClockSynchronization 

Source
pub struct ClockSynchronization<A: Time, B: Time> { /* private fields */ }
Expand description

A pair of instants from two clocks that correspond to roughly the same point in time.

Implementations§

Source§

impl<A: Time, B: Time> ClockSynchronization<A, B>

Source

pub fn new(epoch_a: A::Instant, epoch_b: B::Instant) -> Self

Creates a synchronization from a known pair of corresponding instants.

Source

pub fn new_aba_calibrated<CA, CB>(a: &CalibratedClock<CA>, b: &CB) -> Self
where CA: Clock<Time = A>, CB: Clock<Time = B>,

Creates a synchronization by sampling both clocks in an A-B-A pattern.

Multiple measurements are performed and the one with least error is selected.

Source

pub fn to_a<CA, CB>(&self, t: B::Instant, a: &CA, b: &CB) -> A::Instant

Converts an instant from clock B’s domain to clock A’s domain.

Works for instants both before and after the synchronization epoch.

Source

pub fn to_b<CA, CB>(&self, t: A::Instant, a: &CA, b: &CB) -> B::Instant

Converts an instant from clock A’s domain to clock B’s domain.

Works for instants both before and after the synchronization epoch.

Source

pub fn to_a_after_epoch<CA, CB>( &self, t: B::Instant, a: &CA, b: &CB, ) -> A::Instant

Converts an instant from clock B’s domain to clock A’s domain, assuming t is at or after the synchronization epoch.

Possibly faster than to_a. Behavior when t is before the epoch is unspecified: The function may panic or return a meaningless value. Use to_a if unsure.

Source

pub fn to_b_after_epoch<CA, CB>( &self, t: A::Instant, a: &CA, b: &CB, ) -> B::Instant

Converts an instant from clock A’s domain to clock B’s domain, assuming t is at or after the synchronization epoch.

Possibly faster than to_b. Behavior when t is before the epoch is unspecified: The function may panic or return a meaningless value. Use to_b if unsure.

Source

pub fn epoch_a(&self) -> A::Instant

Returns the synchronization epoch in clock A’s domain.

Source

pub fn epoch_b(&self) -> B::Instant

Returns the synchronization epoch in clock B’s domain.

Trait Implementations§

Source§

impl<A: Time, B: Time> Clone for ClockSynchronization<A, B>

Source§

fn clone(&self) -> Self

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<A: Time, B: Time> Copy for ClockSynchronization<A, B>

Source§

impl<A: Time, B: Time> Debug for ClockSynchronization<A, B>
where A::Instant: Debug, B::Instant: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A, B> Freeze for ClockSynchronization<A, B>
where <A as Time>::Instant: Freeze, <B as Time>::Instant: Freeze,

§

impl<A, B> RefUnwindSafe for ClockSynchronization<A, B>

§

impl<A, B> Send for ClockSynchronization<A, B>
where <A as Time>::Instant: Send, <B as Time>::Instant: Send,

§

impl<A, B> Sync for ClockSynchronization<A, B>
where <A as Time>::Instant: Sync, <B as Time>::Instant: Sync,

§

impl<A, B> Unpin for ClockSynchronization<A, B>
where <A as Time>::Instant: Unpin, <B as Time>::Instant: Unpin,

§

impl<A, B> UnsafeUnpin for ClockSynchronization<A, B>
where <A as Time>::Instant: UnsafeUnpin, <B as Time>::Instant: UnsafeUnpin,

§

impl<A, B> UnwindSafe for ClockSynchronization<A, B>
where <A as Time>::Instant: UnwindSafe, <B as Time>::Instant: UnwindSafe,

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.