pub trait TimestampOps:
Copy
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
+ Debug
+ Add<FTs, Output = Self>
+ Sub<FTs, Output = Self>
+ AddAssign<FTs>
+ SubAssign<FTs> {
// Required methods
fn from_tstates(ts: FTs) -> Self;
fn into_tstates(self) -> FTs;
fn max_value() -> Self;
fn min_value() -> Self;
fn diff_from(self, ts_from: Self) -> FTs;
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§
Sourcefn from_tstates(ts: FTs) -> Self
fn from_tstates(ts: FTs) -> Self
Returns a normalized timestamp from the given number of T-states.
§Panics
Panics when the given ts
overflows the capacity of the timestamp.
Sourcefn into_tstates(self) -> FTs
fn into_tstates(self) -> FTs
Sourcefn max_value() -> Self
fn max_value() -> Self
Returns the largest value that can be represented by a normalized timestamp.
Sourcefn min_value() -> Self
fn min_value() -> Self
Returns the smallest value that can be represented by a normalized timestamp.
Sourcefn diff_from(self, ts_from: Self) -> FTs
fn diff_from(self, ts_from: Self) -> FTs
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.
Sourcefn saturating_add(self, other: Self) -> Self
fn saturating_add(self, other: Self) -> Self
Returns a normalized timestamp after adding other
to it.
Saturates at TimestampOps::min_value or TimestampOps::max_value.
Sourcefn saturating_sub(self, other: Self) -> Self
fn saturating_sub(self, other: Self) -> Self
Returns a normalized timestamp after subtracting other
from it.
Saturates at TimestampOps::min_value or TimestampOps::max_value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.