1
1
//! Callback-style timer APIs.
2
2
3
3
use super :: sys:: * ;
4
- use std:: fmt;
5
4
use wasm_bindgen:: prelude:: * ;
6
5
use wasm_bindgen:: JsCast ;
7
6
@@ -11,6 +10,7 @@ use wasm_bindgen::JsCast;
11
10
///
12
11
/// Once scheduled, you can either `cancel` so that it doesn't run or `forget`
13
12
/// it so that it is un-cancel-able.
13
+ #[ derive( Debug ) ]
14
14
#[ must_use = "timeouts cancel on drop; either call `forget` or `drop` explicitly" ]
15
15
pub struct Timeout {
16
16
id : Option < i32 > ,
@@ -25,12 +25,6 @@ impl Drop for Timeout {
25
25
}
26
26
}
27
27
28
- impl fmt:: Debug for Timeout {
29
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
30
- f. debug_struct ( "Timeout" ) . field ( "id" , & self . id ) . finish ( )
31
- }
32
- }
33
-
34
28
impl Timeout {
35
29
/// Schedule a timeout to invoke `callback` in `millis` milliseconds from
36
30
/// now.
@@ -114,6 +108,7 @@ impl Timeout {
114
108
///
115
109
/// Once scheduled, you can either `cancel` so that it ceases to fire or `forget`
116
110
/// it so that it is un-cancel-able.
111
+ #[ derive( Debug ) ]
117
112
#[ must_use = "intervals cancel on drop; either call `forget` or `drop` explicitly" ]
118
113
pub struct Interval {
119
114
id : Option < i32 > ,
@@ -128,12 +123,6 @@ impl Drop for Interval {
128
123
}
129
124
}
130
125
131
- impl fmt:: Debug for Interval {
132
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
133
- f. debug_struct ( "Interval" ) . field ( "id" , & self . id ) . finish ( )
134
- }
135
- }
136
-
137
126
impl Interval {
138
127
/// Schedule an interval to invoke `callback` every `millis` milliseconds.
139
128
///
0 commit comments