Skip to content

Commit 9c0f815

Browse files
authored
Rollup merge of rust-lang#84453 - notriddle:waker-from-docs, r=cramertj
Document From implementations for Waker and RawWaker CC rust-lang#51430
2 parents ad3a83a + 4abe8f5 commit 9c0f815

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

alloc/src/task.rs

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ pub trait Wake {
8787

8888
#[stable(feature = "wake_trait", since = "1.51.0")]
8989
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
90+
/// Use a `Wake`-able type as a `Waker`.
91+
///
92+
/// No heap allocations or atomic operations are used for this conversion.
9093
fn from(waker: Arc<W>) -> Waker {
9194
// SAFETY: This is safe because raw_waker safely constructs
9295
// a RawWaker from Arc<W>.
@@ -96,6 +99,9 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
9699

97100
#[stable(feature = "wake_trait", since = "1.51.0")]
98101
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker {
102+
/// Use a `Wake`-able type as a `RawWaker`.
103+
///
104+
/// No heap allocations or atomic operations are used for this conversion.
99105
fn from(waker: Arc<W>) -> RawWaker {
100106
raw_waker(waker)
101107
}

0 commit comments

Comments
 (0)