Document From implementations for Waker and RawWaker
This commit is contained in:
parent
6df26f897c
commit
60ff298070
1 changed files with 6 additions and 0 deletions
|
@ -87,6 +87,9 @@ pub trait Wake {
|
||||||
|
|
||||||
#[stable(feature = "wake_trait", since = "1.51.0")]
|
#[stable(feature = "wake_trait", since = "1.51.0")]
|
||||||
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for Waker {
|
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 {
|
fn from(waker: Arc<W>) -> Waker {
|
||||||
// SAFETY: This is safe because raw_waker safely constructs
|
// SAFETY: This is safe because raw_waker safely constructs
|
||||||
// a RawWaker from Arc<W>.
|
// 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")]
|
#[stable(feature = "wake_trait", since = "1.51.0")]
|
||||||
impl<W: Wake + Send + Sync + 'static> From<Arc<W>> for RawWaker {
|
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 {
|
fn from(waker: Arc<W>) -> RawWaker {
|
||||||
raw_waker(waker)
|
raw_waker(waker)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue