File tree 3 files changed +7
-1
lines changed 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ pub use webcore::number::Number;
166
166
pub use webcore:: object:: Object ;
167
167
pub use webcore:: array:: Array ;
168
168
pub use webcore:: symbol:: Symbol ;
169
+ pub use webcore:: cancel:: { Cancel , AutoCancel } ;
169
170
170
171
pub use webcore:: unsafe_typed_array:: UnsafeTypedArray ;
171
172
pub use webcore:: once:: Once ;
Original file line number Diff line number Diff line change 1
1
use std:: ops:: { Deref , DerefMut } ;
2
2
3
3
4
+ ///
4
5
pub trait Cancel {
6
+ ///
5
7
fn cancel ( & mut self ) ;
6
8
}
7
9
8
10
11
+ ///
9
12
#[ must_use = "
10
13
11
14
The AutoCancel is unused, which causes it to be immediately cancelled.
@@ -21,11 +24,13 @@ pub trait Cancel {
21
24
pub struct AutoCancel < A : Cancel > ( Option < A > ) ;
22
25
23
26
impl < A : Cancel > AutoCancel < A > {
27
+ ///
24
28
#[ inline]
25
29
pub fn new ( canceler : A ) -> Self {
26
30
AutoCancel ( Some ( canceler ) )
27
31
}
28
32
33
+ ///
29
34
#[ inline]
30
35
pub fn leak ( mut self ) -> A {
31
36
self . 0 . take ( ) . unwrap ( )
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ impl Promise {
105
105
/// no longer interested in the `Promise`'s result.
106
106
///
107
107
/// But if you *are* interested in the `Promise`'s result, then you either need to make sure to keep the handle
108
- /// alive until after the callback is called, or you need to use the `leak` method.
108
+ /// alive until after the callback is called, or you need to use the [ `leak`](struct.AutoCancel.html#method.leak) method.
109
109
///
110
110
/// Cancelling the [`DoneHandle`](struct.DoneHandle.html) does ***not*** cancel the `Promise`, because promises
111
111
/// do not support cancellation.
You can’t perform that action at this time.
0 commit comments