pub struct Ticks<const HZ: u32>(pub u32);
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> Freeze for Ticks<HZ>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 4 bytes