pub struct TimerScheduler {
pub(crate) queue: BinaryHeap<ScheduledEvent>,
}
Expand description
A queue of TimerEventRequest
s that are stored in order of next-to-fire.
Fields§
§queue: BinaryHeap<ScheduledEvent>
A priority queue of future events, sorted by due time.
Implementations§
Source§impl TimerScheduler
impl TimerScheduler
Sourcepub fn schedule_timer(&mut self, request: TimerEventRequest)
pub fn schedule_timer(&mut self, request: TimerEventRequest)
Schedule a new timer for on this TimerScheduler
.
Sourcepub fn wait_channel(&self) -> Receiver<Instant>
pub fn wait_channel(&self) -> Receiver<Instant>
Get a Receiver<Instant>
that receives a message after waiting for the next timer
to fire. If there are no timers, the channel will never send a message.
Sourcepub fn dispatch_completed_timers(&mut self)
pub fn dispatch_completed_timers(&mut self)
Dispatch any timer events from this TimerScheduler
’s queue
when now
is
past the due time of the event.
Trait Implementations§
Source§impl Default for TimerScheduler
impl Default for TimerScheduler
Source§fn default() -> TimerScheduler
fn default() -> TimerScheduler
Returns the “default value” for a type. Read more
Source§impl MallocSizeOf for TimerScheduler
impl MallocSizeOf for TimerScheduler
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl Freeze for TimerScheduler
impl !RefUnwindSafe for TimerScheduler
impl Send for TimerScheduler
impl !Sync for TimerScheduler
impl Unpin for TimerScheduler
impl !UnwindSafe for TimerScheduler
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
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert