Skip to content

Commit

Permalink
Adding in documentation stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauan committed Feb 23, 2018
1 parent 3999890 commit 4b445d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ pub use webcore::number::Number;
pub use webcore::object::Object;
pub use webcore::array::Array;
pub use webcore::symbol::Symbol;
pub use webcore::cancel::{Cancel, AutoCancel};

pub use webcore::unsafe_typed_array::UnsafeTypedArray;
pub use webcore::once::Once;
Expand Down
5 changes: 5 additions & 0 deletions src/webcore/cancel.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use std::ops::{Deref, DerefMut};


///
pub trait Cancel {
///
fn cancel( &mut self );
}


///
#[must_use = "
The AutoCancel is unused, which causes it to be immediately cancelled.
Expand All @@ -21,11 +24,13 @@ pub trait Cancel {
pub struct AutoCancel< A: Cancel >( Option< A > );

impl< A: Cancel > AutoCancel< A > {
///
#[inline]
pub fn new( canceler: A ) -> Self {
AutoCancel( Some( canceler ) )
}

///
#[inline]
pub fn leak( mut self ) -> A {
self.0.take().unwrap()
Expand Down
2 changes: 1 addition & 1 deletion src/webcore/promise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Promise {
/// no longer interested in the `Promise`'s result.
///
/// But if you *are* interested in the `Promise`'s result, then you either need to make sure to keep the handle
/// alive until after the callback is called, or you need to use the `leak` method.
/// alive until after the callback is called, or you need to use the [`leak`](struct.AutoCancel.html#method.leak) method.
///
/// Cancelling the [`DoneHandle`](struct.DoneHandle.html) does ***not*** cancel the `Promise`, because promises
/// do not support cancellation.
Expand Down

0 comments on commit 4b445d9

Please sign in to comment.