Skip to content

Commit

Permalink
chore: make method order consistent with waker
Browse files Browse the repository at this point in the history
  • Loading branch information
tvallotton committed Jan 13, 2024
1 parent 95bf689 commit c61eab8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit c61eab8

Please sign in to comment.