diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-04-24 12:17:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-24 12:17:06 +0900 |
| commit | ed5646bfeed5ccf8d4f17fe76efd47ce1731d050 (patch) | |
| tree | 5a3d75e0caee75b8e5eddfe8e7049dec19856715 /library/alloc/src | |
| parent | 570eed71ef123557ca8c4c527c404f1331282ef1 (diff) | |
| parent | 60ff298070842e8bb47078c7c3a0dbbdebc1d5a6 (diff) | |
| download | rust-ed5646bfeed5ccf8d4f17fe76efd47ce1731d050.tar.gz rust-ed5646bfeed5ccf8d4f17fe76efd47ce1731d050.zip | |
Rollup merge of #84453 - notriddle:waker-from-docs, r=cramertj
Document From implementations for Waker and RawWaker CC #51430
Diffstat (limited to 'library/alloc/src')
| -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) } |
