File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -87,20 +87,9 @@ impl Delay {
87
87
88
88
/// Resets this timeout to an new timeout which will fire at the time
89
89
/// specified by `at`.
90
- ///
91
- /// This method is usable even of this instance of `Delay` has "already
92
- /// fired". That is, if this future has resovled, calling this method means
93
- /// that the future will still re-resolve at the specified instant.
94
- ///
95
- /// If `at` is in the past then this future will immediately be resolved
96
- /// (when `poll` is called).
97
- ///
98
- /// Note that if any task is currently blocked on this future then that task
99
- /// will be dropped. It is required to call `poll` again after this method
100
- /// has been called to ensure tha ta task is blocked on this future.
101
90
#[ inline]
102
- pub fn reset ( & mut self , dur : Duration ) {
103
- self . when = Instant :: now ( ) + dur ;
91
+ pub fn reset ( & mut self , at : Instant ) {
92
+ self . when = at ;
104
93
if self . _reset ( self . when ) . is_err ( ) {
105
94
self . state = None
106
95
}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ async fn reset() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
24
24
assert ! ( i. elapsed( ) > dur) ;
25
25
26
26
let i = Instant :: now ( ) ;
27
- d. reset ( dur) ;
27
+ d. reset ( Instant :: now ( ) + dur) ;
28
28
d. await ;
29
29
assert ! ( i. elapsed( ) > dur) ;
30
30
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments