pub struct Alarm { /* private fields */ }Expand description
An alarm that can be Armed to fire at some future time.
Alarm is itself owned, and may have multiple sleepers attached to it. Each sleeper is awoken at most once for each alarm that has been set.
When instances of Alarm are dropped, sleepers are awoken,
returning false, indicating that the alarm is defunct.
Implementations§
Source§impl Alarm
impl Alarm
Sourcepub fn rearm(&mut self, duration: Duration)
pub fn rearm(&mut self, duration: Duration)
Arm the alarm to fire duration after the alarm was originally armed.
This behaves as if arm was called originally with the new duration.
If it has not been armed it behaves the same as arm.
Sourcepub fn sleeper(&self) -> AlarmSleeper
pub fn sleeper(&self) -> AlarmSleeper
Create a new sleeper for this alarm. Many sleepers can wait for the alarm to fire at any given time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Alarm
impl RefUnwindSafe for Alarm
impl Send for Alarm
impl Sync for Alarm
impl Unpin for Alarm
impl UnwindSafe for Alarm
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more