#[repr(C)]pub struct HrTimer<T> { /* private fields */ }
Expand description
A timer backed by a C struct hrtimer
.
§Invariants
self.timer
is initialized bybindings::hrtimer_setup
.
Implementations§
Source§impl<T> HrTimer<T>
impl<T> HrTimer<T>
Sourcepub fn new() -> impl PinInit<Self>where
T: HrTimerCallback + HasHrTimer<T>,
pub fn new() -> impl PinInit<Self>where
T: HrTimerCallback + HasHrTimer<T>,
Return an initializer for a new timer instance.
Sourcepub fn forward(
self: Pin<&mut Self>,
now: HrTimerInstant<T>,
interval: Delta,
) -> u64where
T: HasHrTimer<T>,
pub fn forward(
self: Pin<&mut Self>,
now: HrTimerInstant<T>,
interval: Delta,
) -> u64where
T: HasHrTimer<T>,
Conditionally forward the timer.
If the timer expires after now
, this function does nothing and returns 0. If the timer
expired at or before now
, this function forwards the timer by interval
until the timer
expires after now
and then returns the number of times the timer was forwarded by
interval
.
This function is mainly useful for timer types which can provide exclusive access to the
timer when the timer is not running. For forwarding the timer from within the timer callback
context, see HrTimerCallbackContext::forward()
.
Returns the number of overruns that occurred as a result of the timer expiry change.
Sourcepub fn forward_now(self: Pin<&mut Self>, interval: Delta) -> u64where
T: HasHrTimer<T>,
pub fn forward_now(self: Pin<&mut Self>, interval: Delta) -> u64where
T: HasHrTimer<T>,
Sourcepub fn expires(&self) -> HrTimerInstant<T>where
T: HasHrTimer<T>,
pub fn expires(&self) -> HrTimerInstant<T>where
T: HasHrTimer<T>,
Return the time expiry for this HrTimer
.
This value should only be used as a snapshot, as the actual expiry time could change after this function is called.
Trait Implementations§
impl<T> Send for HrTimer<T>
impl<T> Sync for HrTimer<T>
Auto Trait Implementations§
impl<T> !Freeze for HrTimer<T>
impl<T> !RefUnwindSafe for HrTimer<T>
impl<T> UnwindSafe for HrTimer<T>where
T: UnwindSafe,
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> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot
. Read more