@@ -38,16 +38,7 @@ impl Delay {
38
38
/// The default timer will be spun up in a helper thread on first use.
39
39
#[ inline]
40
40
pub fn new ( dur : Duration ) -> Delay {
41
- Delay :: new_at ( Instant :: now ( ) + dur)
42
- }
43
-
44
- /// Creates a new future which will fire at the time specified by `at`.
45
- ///
46
- /// The returned object will be bound to the default timer for this thread.
47
- /// The default timer will be spun up in a helper thread on first use.
48
- #[ inline]
49
- pub fn new_at ( at : Instant ) -> Delay {
50
- Delay :: new_handle ( at, Default :: default ( ) )
41
+ Delay :: new_handle ( Instant :: now ( ) + dur, Default :: default ( ) )
51
42
}
52
43
53
44
/// Creates a new future which will fire at the time specified by `at`.
@@ -89,15 +80,6 @@ impl Delay {
89
80
}
90
81
}
91
82
92
- /// Resets this timeout to an new timeout which will fire at the time
93
- /// specified by `dur`.
94
- ///
95
- /// This is equivalent to calling `reset_at` with `Instant::now() + dur`
96
- #[ inline]
97
- pub fn reset ( & mut self , dur : Duration ) {
98
- self . reset_at ( Instant :: now ( ) + dur)
99
- }
100
-
101
83
/// Resets this timeout to an new timeout which will fire at the time
102
84
/// specified by `at`.
103
85
///
@@ -112,9 +94,9 @@ impl Delay {
112
94
/// will be dropped. It is required to call `poll` again after this method
113
95
/// has been called to ensure tha ta task is blocked on this future.
114
96
#[ inline]
115
- pub fn reset_at ( & mut self , at : Instant ) {
116
- self . when = at ;
117
- if self . _reset ( at ) . is_err ( ) {
97
+ pub fn reset ( & mut self , dur : Duration ) {
98
+ self . when = Instant :: now ( ) + dur ;
99
+ if self . _reset ( self . when ) . is_err ( ) {
118
100
self . state = None
119
101
}
120
102
}
0 commit comments