Adjusted documentation and reset_after behaviour.
This commit is contained in:
parent
663fa2addd
commit
8707462ec2
@ -185,13 +185,15 @@ impl Ticker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reset the ticker to fire for the next time on the deadline.
|
/// 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) {
|
pub fn reset_at(&mut self, deadline: Instant) {
|
||||||
self.expires_at = deadline;
|
self.expires_at = deadline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets the ticker, after the specified duration has passed.
|
/// 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) {
|
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.
|
/// Waits for the next tick.
|
||||||
|
Loading…
Reference in New Issue
Block a user