pub struct Timer { /* private fields */ }Expand description
A timer that does not trigger an update in a timer list. These are usually owned by individual components and needs to be explicitly polled.
Note: The timer doesn’t implement Copy to ensure it isn’t accidentally moved and have the expiration discarded.
Implementations
sourceimpl Timer
impl Timer
sourcepub fn cancel(&mut self)
pub fn cancel(&mut self)
Cancels the timer. After cancellation, a timer will no longer report as expired.
sourcepub fn is_expired(&self, current_time: Timestamp) -> bool
pub fn is_expired(&self, current_time: Timestamp) -> bool
Returns true if the timer has expired
sourcepub fn poll_expiration(&mut self, current_time: Timestamp) -> Poll<()>
pub fn poll_expiration(&mut self, current_time: Timestamp) -> Poll<()>
Notifies the timer of the current time. If the timer’s expiration occurs before the current time, it will be cancelled. The method returns whether the timer was expired and had been cancelled.
Trait Implementations
sourceimpl Provider for Timer
impl Provider for Timer
sourcefn timers<Q: Query>(&self, query: &mut Q) -> Result
fn timers<Q: Query>(&self, query: &mut Q) -> Result
Notifies the query of any timers owned by the provider Read more
sourcefn next_expiration(&self) -> Option<Timestamp>
fn next_expiration(&self) -> Option<Timestamp>
Returns the next Timestamp at which the earliest timer is armed in the provider
sourcefn armed_timer_count(&self) -> usize
fn armed_timer_count(&self) -> usize
Counts the number of armed timers in the provider
sourcefn for_each_timer<F: FnMut(&Timer) -> Result>(&self, f: F)
fn for_each_timer<F: FnMut(&Timer) -> Result>(&self, f: F)
Iterates over each timer in the provider and calls the provided function
impl Eq for Timer
impl StructuralEq for Timer
impl StructuralPartialEq for Timer
Auto Trait Implementations
impl RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl UnwindSafe for Timer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more