Merge pull request #228 from en/reset

Add a method to reset Timeout.
This commit is contained in:
Alex Crichton
2017-06-27 09:52:02 -07:00
committed by GitHub
+7
View File
@@ -46,6 +46,13 @@ impl Timeout {
handle: handle.remote().clone(),
})
}
/// Resets this timeout to an new timeout which will fire at the time
/// specified by `at`.
pub fn reset(&mut self, at: Instant) {
self.when = at;
self.token.reset_timeout(self.when, &self.handle);
}
}
impl Future for Timeout {