mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
Clarify docs on Timeout::reset
This commit is contained in:
@@ -49,6 +49,17 @@ impl Timeout {
|
||||
|
||||
/// Resets this timeout to an new timeout which will fire at the time
|
||||
/// specified by `at`.
|
||||
///
|
||||
/// This method is usable even of this instance of `Timeout` has "already
|
||||
/// fired". That is, if this future has resovled, calling this method means
|
||||
/// that the future will still re-resolve at the specified instant.
|
||||
///
|
||||
/// If `at` is in the past then this future will immediately be resolved
|
||||
/// (when `poll` is called).
|
||||
///
|
||||
/// Note that if any task is currently blocked on this future then that task
|
||||
/// will be dropped. It is required to call `poll` again after this method
|
||||
/// has been called to ensure tha ta task is blocked on this future.
|
||||
pub fn reset(&mut self, at: Instant) {
|
||||
self.when = at;
|
||||
self.token.reset_timeout(self.when, &self.handle);
|
||||
|
||||
Reference in New Issue
Block a user