From c61eab83fb0919ec012f512ba26a94e0e1b9e9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Vallotton?= Date: Sat, 13 Jan 2024 11:18:18 -0300 Subject: [PATCH] chore: make method order consistent with waker --- library/core/src/task/wake.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 535d846dcec89..830ebda4b3fef 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -708,6 +708,19 @@ impl LocalWaker { self.waker == other.waker } + /// Creates a new `LocalWaker` from [`RawWaker`]. + /// + /// The behavior of the returned `LocalWaker` is undefined if the contract defined + /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld. + /// Therefore this method is unsafe. + #[inline] + #[must_use] + #[stable(feature = "futures_api", since = "1.36.0")] + #[rustc_const_unstable(feature = "const_waker", issue = "102012")] + pub const unsafe fn from_raw(waker: RawWaker) -> LocalWaker { + Self { waker } + } + /// Creates a new `LocalWaker` that does nothing when `wake` is called. /// /// This is mostly useful for writing tests that need a [`Context`] to poll @@ -737,19 +750,6 @@ impl LocalWaker { LocalWaker { waker: RawWaker::NOOP } } - /// Creates a new `LocalWaker` from [`RawWaker`]. - /// - /// The behavior of the returned `LocalWaker` is undefined if the contract defined - /// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld. - /// Therefore this method is unsafe. - #[inline] - #[must_use] - #[stable(feature = "futures_api", since = "1.36.0")] - #[rustc_const_unstable(feature = "const_waker", issue = "102012")] - pub const unsafe fn from_raw(waker: RawWaker) -> LocalWaker { - Self { waker } - } - /// Get a reference to the underlying [`RawWaker`]. #[inline] #[must_use]