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

A trait providing calculation methods for timestamps.

Allows BusDevice implementations to depend on a generic timestamp type.

Required Methods§

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

Panics

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

Converts the timestamp to FTs.

Panics

Panics when self overflows the capacity of the result type.

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

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

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.

Returns a normalized timestamp after adding other to it.

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

Returns a normalized timestamp after subtracting other from it.

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

Implementations on Foreign Types§

Implementors§