diff options
| author | Michael Howell <michael@notriddle.com> | 2021-04-22 14:16:33 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2021-04-22 14:16:33 -0700 |
| commit | 60ff298070842e8bb47078c7c3a0dbbdebc1d5a6 (patch) | |
| tree | d04b76f5b7bc620788663a2664c77b6014716c04 | |
| parent | 6df26f897cffb2d86880544bb451c6b5f8509b2d (diff) | |
| download | rust-60ff298070842e8bb47078c7c3a0dbbdebc1d5a6.tar.gz rust-60ff298070842e8bb47078c7c3a0dbbdebc1d5a6.zip | |
Document From implementations for Waker and RawWaker
| -rw-r--r-- | library/alloc/src/task.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/alloc/src/task.rs b/library/alloc/src/task.rs index 58a9ae77244..528ee4ff154 100644 --- a/library/alloc/src/task.rs +++ b/library/alloc/src/task.rs @@ -87,6 +87,9 @@ pub trait Wake { #[stable(feature = "wake_trait", since = "1.51.0")] impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker { + /// Use a `Wake`-able type as a `Waker`. + /// + /// No heap allocations or atomic operations are used for this conversion. fn from(waker: Arc<W>) -> Waker { // SAFETY: This is safe because raw_waker safely constructs // a RawWaker from Arc<W>. @@ -96,6 +99,9 @@ impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker { #[stable(feature = "wake_trait", since = "1.51.0")] impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker { + /// Use a `Wake`-able type as a `RawWaker`. + /// + /// No heap allocations or atomic operations are used for this conversion. fn from(waker: Arc<W>) -> RawWaker { raw_waker(waker) } |
