aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2020-09-18 14:31:53 +0200
committerStjepan Glavina <stjepang@gmail.com>2020-09-18 14:31:53 +0200
commitdeb709f4198c4c6d1c691a69f5cd713d040e0fed (patch)
treeb00b7b94df7f0e4ca8b1ab41e7eea81020765c21 /src
parentc533cc6a78f12099143f2230a851abb77d0e67c2 (diff)
downloadasync-task-deb709f4198c4c6d1c691a69f5cd713d040e0fed.tar.gz
Replace crossbeam with flume
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs6
-rw-r--r--src/task.rs26
2 files changed, 5 insertions, 27 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9b2e174..63ca99c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,7 +9,7 @@
//! All executors have some kind of queue that holds runnable tasks:
//!
//! ```
-//! let (sender, receiver) = crossbeam::channel::unbounded();
+//! let (sender, receiver) = flume::unbounded();
//! #
//! # // A future that will get spawned.
//! # let future = async { 1 + 2 };
@@ -24,7 +24,7 @@
//! A task is constructed using either [`spawn`] or [`spawn_local`]:
//!
//! ```
-//! # let (sender, receiver) = crossbeam::channel::unbounded();
+//! # let (sender, receiver) = flume::unbounded();
//! #
//! // A future that will be spawned.
//! let future = async { 1 + 2 };
@@ -47,7 +47,7 @@
//! runnable tasks out of the queue and running each one in order:
//!
//! ```no_run
-//! # let (sender, receiver) = crossbeam::channel::unbounded();
+//! # let (sender, receiver) = flume::unbounded();
//! #
//! # // A future that will get spawned.
//! # let future = async { 1 + 2 };
diff --git a/src/task.rs b/src/task.rs
index 7374cf4..4850e00 100644
--- a/src/task.rs
+++ b/src/task.rs
@@ -33,15 +33,13 @@ use crate::JoinHandle;
/// # Examples
///
/// ```
-/// use crossbeam::channel;
-///
/// // The future inside the task.
/// let future = async {
/// println!("Hello, world!");
/// };
///
/// // If the task gets woken up, it will be sent into this channel.
-/// let (s, r) = channel::unbounded();
+/// let (s, r) = flume::unbounded();
/// let schedule = move |task| s.send(task).unwrap();
///
/// // Create a task with the future and the schedule function.
@@ -94,15 +92,13 @@ where
/// # Examples
///
/// ```
-/// use crossbeam::channel;
-///
/// // The future inside the task.
/// let future = async {
/// println!("Hello, world!");
/// };
///
/// // If the task gets woken up, it will be sent into this channel.
-/// let (s, r) = channel::unbounded();
+/// let (s, r) = flume::unbounded();
/// let schedule = move |task| s.send(task).unwrap();
///
/// // Create a task with the future and the schedule function.
@@ -266,24 +262,6 @@ impl Task {
Waker::from_raw(raw_waker)
}
}
-
- /// Converts this task into a raw pointer.
- pub fn into_raw(self) -> *mut () {
- let ptr = self.raw_task.as_ptr();
- mem::forget(self);
- ptr
- }
-
- /// Converts a raw pointer into a task.
- ///
- /// This method should only be used with raw pointers returned from [`into_raw`].
- ///
- /// [`into_raw`]: #method.into_raw
- pub unsafe fn from_raw(raw: *mut ()) -> Task {
- Task {
- raw_task: NonNull::new_unchecked(raw as *mut ()),
- }
- }
}
impl Drop for Task {