pub struct Timer { /* private fields */ }
Expand description
A naive timer.
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn add(
&mut self,
deadline: Duration,
callback: impl FnOnce(Duration) + Send + Sync + 'static,
)
pub fn add( &mut self, deadline: Duration, callback: impl FnOnce(Duration) + Send + Sync + 'static, )
Add a timer.
The callback
will be called on timer expired after deadline
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Timer
impl !RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl !UnwindSafe for Timer
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