Adjusted documentation and reset_after behaviour.
This commit is contained in:
parent
663fa2addd
commit
8707462ec2
1 changed files with 3 additions and 1 deletions
|
@ -185,13 +185,15 @@ impl Ticker {
|
|||
}
|
||||
|
||||
/// Reset the ticker to fire for the next time on the deadline.
|
||||
/// If the deadline is in the past, the ticker will fire instantly.
|
||||
pub fn reset_at(&mut self, deadline: Instant) {
|
||||
self.expires_at = deadline;
|
||||
}
|
||||
|
||||
/// Resets the ticker, after the specified duration has passed.
|
||||
/// If the specified duration is zero, the next tick will be after the duration of the ticker.
|
||||
pub fn reset_after(&mut self, after: Duration) {
|
||||
self.expires_at = Instant::now() + after;
|
||||
self.expires_at = Instant::now() + after + self.duration;
|
||||
}
|
||||
|
||||
/// Waits for the next tick.
|
||||
|
|
Loading…
Reference in a new issue