This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -710,6 +710,19 @@ impl LocalWaker {
710710 self . waker == other. waker
711711 }
712712
713+ /// Creates a new `LocalWaker` from [`RawWaker`].
714+ ///
715+ /// The behavior of the returned `LocalWaker` is undefined if the contract defined
716+ /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
717+ /// Therefore this method is unsafe.
718+ #[ inline]
719+ #[ must_use]
720+ #[ stable( feature = "futures_api" , since = "1.36.0" ) ]
721+ #[ rustc_const_unstable( feature = "const_waker" , issue = "102012" ) ]
722+ pub const unsafe fn from_raw ( waker : RawWaker ) -> LocalWaker {
723+ Self { waker }
724+ }
725+
713726 /// Creates a new `LocalWaker` that does nothing when `wake` is called.
714727 ///
715728 /// This is mostly useful for writing tests that need a [`Context`] to poll
@@ -740,19 +753,6 @@ impl LocalWaker {
740753 WAKER
741754 }
742755
743- /// Creates a new `LocalWaker` from [`RawWaker`].
744- ///
745- /// The behavior of the returned `LocalWaker` is undefined if the contract defined
746- /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
747- /// Therefore this method is unsafe.
748- #[ inline]
749- #[ must_use]
750- #[ stable( feature = "futures_api" , since = "1.36.0" ) ]
751- #[ rustc_const_unstable( feature = "const_waker" , issue = "102012" ) ]
752- pub const unsafe fn from_raw ( waker : RawWaker ) -> LocalWaker {
753- Self { waker }
754- }
755-
756756 /// Get a reference to the underlying [`RawWaker`].
757757 #[ inline]
758758 #[ must_use]
You can’t perform that action at this time.
0 commit comments