pub struct Timer<E> { /* private fields */ }
Implementations§
Source§impl<E> Timer<E>
impl<E> Timer<E>
pub fn new(sender: EventSender<E>) -> Self
Sourcepub fn now(&self) -> MonotonicInstant
pub fn now(&self) -> MonotonicInstant
Returns the current time according to the global executor.
§Panics
This function will panic if it’s called when no executor is set up.
pub fn schedule_at(&mut self, deadline: MonotonicInstant, event: E) -> EventId
pub fn schedule_after( &mut self, duration: MonotonicDuration, event: E, ) -> EventId
pub fn schedule<EV>(&mut self, event: EV) -> EventIdwhere
EV: TimeoutDuration + Into<E>,
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Timer<E>
impl<E> !RefUnwindSafe for Timer<E>
impl<E> Send for Timer<E>where
E: Send,
impl<E> Sync for Timer<E>where
E: Send,
impl<E> Unpin for Timer<E>
impl<E> !UnwindSafe for Timer<E>
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