pub enum TimerSpec {
Absolute {
nanos_since_boot: u64,
},
Relative {
nanos: u64,
},
}Expand description
Timer specification for timer_wait.
Timers can be absolute (wait until a specific instant) or relative (wait for a duration from now).
Variants§
Absolute
Wait until an absolute instant.
The instant is represented as nanoseconds since kernel boot.
Relative
Wait for a relative duration.
The duration is represented as nanoseconds.
Implementations§
Source§impl TimerSpec
impl TimerSpec
Sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
Creates a relative timer from milliseconds.
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Creates a relative timer from microseconds.
Sourcepub const fn is_absolute(&self) -> bool
pub const fn is_absolute(&self) -> bool
Returns true if this is an absolute timer.
Sourcepub const fn is_relative(&self) -> bool
pub const fn is_relative(&self) -> bool
Returns true if this is a relative timer.
Trait Implementations§
impl Copy for TimerSpec
impl Eq for TimerSpec
impl StructuralPartialEq for TimerSpec
Auto Trait Implementations§
impl Freeze for TimerSpec
impl RefUnwindSafe for TimerSpec
impl Send for TimerSpec
impl Sync for TimerSpec
impl Unpin for TimerSpec
impl UnsafeUnpin for TimerSpec
impl UnwindSafe for TimerSpec
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