Struct riot_wrappers::ztimer::Ticks
source · pub struct Ticks<const HZ: u32>(pub u32);
Available on
riot_module_ztimer
only.Expand description
A duration on a clock of fixed speed
In memory, these are numbers of ticks. Semantically, these are durations of self.0 / HZ
seconds.
Tuple Fields§
§0: u32
Implementations§
source§impl<const HZ: u32> Ticks<HZ>
impl<const HZ: u32> Ticks<HZ>
sourcepub const fn from_duration(duration: Duration) -> Result<Self, Overflow>
pub const fn from_duration(duration: Duration) -> Result<Self, Overflow>
Fallible conversion from a Duration
This is an extra function (equivalently available as try_from) as it allows the result to be const (which many constructed durations are).
Conversion is not perfect if HZ does not a divisor of $10^9$.
This will be deprecated when TryFrom / TryInto can be optionally const (see https://github.com/rust-lang/rust/issues/67792 for efforts).
Trait Implementations§
impl<const HZ: u32> Copy for Ticks<HZ>
Auto Trait Implementations§
impl<const HZ: u32> RefUnwindSafe for Ticks<HZ>
impl<const HZ: u32> Send for Ticks<HZ>
impl<const HZ: u32> Sync for Ticks<HZ>
impl<const HZ: u32> Unpin for Ticks<HZ>
impl<const HZ: u32> UnwindSafe for Ticks<HZ>
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