Trait UnsafeHrTimerPointer

Source
pub unsafe trait UnsafeHrTimerPointer: Sync + Sized {
    type TimerHandle: HrTimerHandle;

    // Required method
    unsafe fn start(self, expires: Ktime) -> Self::TimerHandle;
}
Expand description

Unsafe version of HrTimerPointer for situations where leaking the HrTimerHandle returned by start would be unsound. This is the case for stack allocated timers.

Typical implementers are pinned references such as Pin<&T>.

§Safety

Implementers of this trait must ensure that instances of types implementing UnsafeHrTimerPointer outlives any associated HrTimerPointer::TimerHandle instances.

Required Associated Types§

Source

type TimerHandle: HrTimerHandle

A handle representing a running timer.

§Safety

If the timer is running, or if the timer callback is executing when the handle is dropped, the drop method of Self::TimerHandle must not return until the timer is stopped and the callback has completed.

Required Methods§

Source

unsafe fn start(self, expires: Ktime) -> Self::TimerHandle

Start the timer after expires time units. If the timer was already running, it is restarted at the new expiry time.

§Safety

Caller promises keep the timer structure alive until the timer is dead. Caller can ensure this by not leaking the returned Self::TimerHandle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T> UnsafeHrTimerPointer for Pin<&'a T>
where T: Send + Sync + HasHrTimer<T> + HrTimerCallback<Pointer<'a> = Self>,

Source§

type TimerHandle = PinHrTimerHandle<'a, T>

Source§

unsafe fn start(self, expires: Ktime) -> Self::TimerHandle

Source§

impl<'a, T> UnsafeHrTimerPointer for Pin<&'a mut T>
where T: Send + Sync + HasHrTimer<T> + HrTimerCallback<Pointer<'a> = Self>,

Source§

type TimerHandle = PinMutHrTimerHandle<'a, T>

Source§

unsafe fn start(self, expires: Ktime) -> Self::TimerHandle

Implementors§