]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/task/wake.rs
Remove spawning from task::Context
[rust.git] / src / libcore / task / wake.rs
index d770536ef4279aebad5730209851c70ae0d63ec4..651db6356ba07e93bd727adb9ed81932a3492fc8 100644 (file)
@@ -123,6 +123,15 @@ pub unsafe fn new(inner: NonNull<dyn UnsafeWake>) -> Self {
         LocalWaker { inner }
     }
 
+    /// Converts this `LocalWaker` into a `Waker`.
+    ///
+    /// `Waker` is nearly identical to `LocalWaker`, but is threadsafe
+    /// (implements `Send` and `Sync`).
+    #[inline]
+    pub fn into_waker(self) -> Waker {
+        self.into()
+    }
+
     /// Wake up the task associated with this `LocalWaker`.
     #[inline]
     pub fn wake(&self) {