Add a method to reset Timeout.

This commit is contained in:
Yuanchao Sun
2017-06-27 11:34:56 +08:00
parent 8379b87c53
commit 6fb62d3232
+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 {