Struct HrTimer

Source
#[repr(C)]
pub struct HrTimer<T> { /* private fields */ }
Expand description

A timer backed by a C struct hrtimer.

§Invariants

  • self.timer is initialized by bindings::hrtimer_setup.

Implementations§

Source§

impl<T> HrTimer<T>

Source

pub fn new() -> impl PinInit<Self>

Return an initializer for a new timer instance.

Source

pub fn forward( self: Pin<&mut Self>, now: HrTimerInstant<T>, interval: Delta, ) -> u64
where 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.

Source

pub fn forward_now(self: Pin<&mut Self>, interval: Delta) -> u64
where T: HasHrTimer<T>,

Conditionally forward the timer.

This is a variant of forward() that uses an interval after the current time of the base clock for the HrTimer.

Source

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§

Source§

impl<T> HasPinData for HrTimer<T>

Source§

type PinData = __ThePinData<T>

Source§

unsafe fn __pin_data() -> Self::PinData

Source§

impl<T> Send for HrTimer<T>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.