Rollup merge of #84453 - notriddle:waker-from-docs, r=cramertj
Document From implementations for Waker and RawWaker CC #51430
This commit is contained in:
commit
ed5646bfee
@ -87,6 +87,9 @@ fn wake_by_ref(self: &Arc<Self>) {
|
||||
|
||||
#[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 @@ fn from(waker: Arc<W>) -> 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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user