Document From implementations for Waker and RawWaker

This commit is contained in:
Michael Howell 2021-04-22 14:16:33 -07:00
parent 6df26f897c
commit 60ff298070

View File

@ -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)
}