[][src]Trait spectrusty_core::clock::TimestampOps

pub trait TimestampOps: Copy + PartialEq + Eq + PartialOrd + Ord + Debug + Add<FTs, Output = Self> + Sub<FTs, Output = Self> + AddAssign<FTs> + SubAssign<FTs> {
    pub fn from_tstates(ts: FTs) -> Self;
pub fn into_tstates(self) -> FTs;
pub fn max_value() -> Self;
pub fn min_value() -> Self;
pub fn diff_from(self, ts_from: Self) -> FTs;
pub fn saturating_add(self, other: Self) -> Self;
pub fn saturating_sub(self, other: Self) -> Self; }

A trait providing calculation methods for timestamps.

Allows BusDevice implementations to depend on a generic timestamp type.

Required methods

pub fn from_tstates(ts: FTs) -> Self[src]

Returns a normalized timestamp from the given number of T-states.

Panics

Panics when the given ts overflows the capacity of the timestamp.

pub fn into_tstates(self) -> FTs[src]

Converts the timestamp to FTs.

Panics

Panics when self overflows the capacity of the result type.

pub fn max_value() -> Self[src]

Returns the largest value that can be represented by a normalized timestamp.

pub fn min_value() -> Self[src]

Returns the smallest value that can be represented by a normalized timestamp.

pub fn diff_from(self, ts_from: Self) -> FTs[src]

Returns the difference between ts_from and self in the number of T-states.

Panics

May panic if the result would exceed the capacity of the result type.

pub fn saturating_add(self, other: Self) -> Self[src]

Returns a normalized timestamp after adding other to it.

Saturates at TimestampOps::min_value or TimestampOps::max_value.

pub fn saturating_sub(self, other: Self) -> Self[src]

Returns a normalized timestamp after subtracting other from it.

Saturates at TimestampOps::min_value or TimestampOps::max_value.

Loading content...

Implementors

impl TimestampOps for FTs[src]

impl<V: VideoFrame> TimestampOps for VFrameTs<V>[src]

pub fn saturating_add(self, other: Self) -> Self[src]

Panics

May panic if self or other hasn't been normalized.

pub fn saturating_sub(self, other: Self) -> Self[src]

Panics

May panic if self or other hasn't been normalized.

Loading content...