#[repr(C, u8)]pub enum Duration {
System(SystemTimeDiff),
Tick(SystemTickDiff),
}Expand description
A span of time, either from the system clock or as tick difference.
Mirrors Instant variants - System durations work with System instants,
Tick durations work with Tick instants.
Variants§
System(SystemTimeDiff)
System duration from std::time::Duration (requires “std” feature)
Tick(SystemTickDiff)
Tick-based duration for embedded systems
Implementations§
Source§impl Duration
impl Duration
Sourcepub fn div(&self, other: &Self) -> f32
pub fn div(&self, other: &Self) -> f32
Divides this duration by another, returning the ratio as f32.
Sourcepub fn greater_than(&self, other: &Self) -> bool
pub fn greater_than(&self, other: &Self) -> bool
Returns true if self > other (panics if variants differ).
Sourcepub fn smaller_than(&self, other: &Self) -> bool
pub fn smaller_than(&self, other: &Self) -> bool
Returns true if self < other (panics if variants differ).
Trait Implementations§
Source§impl From<Duration> for Duration
Available on crate feature std only.
impl From<Duration> for Duration
Available on crate feature
std only.Source§fn from(s: StdDuration) -> Self
fn from(s: StdDuration) -> Self
Converts to this type from the input type.
Source§impl Ord for Duration
impl Ord for Duration
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
impl Copy for Duration
impl Eq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more