Add cautionary paragraph about noop wakers.
Based on a suggestion from @kpreid, with some further editing.
This commit is contained in:
parent
c404406a87
commit
9a95573c2b
@ -539,6 +539,10 @@ pub fn will_wake(&self, other: &Waker) -> bool {
|
|||||||
/// some futures, but are not expecting those futures to wake the waker or
|
/// some futures, but are not expecting those futures to wake the waker or
|
||||||
/// do not need to do anything specific if it happens.
|
/// do not need to do anything specific if it happens.
|
||||||
///
|
///
|
||||||
|
/// More generally, using `Waker::noop()` to poll a future
|
||||||
|
/// means discarding the notification of when the future should be polled again.
|
||||||
|
/// So it should only be used when such a notification will not be needed to make progress.
|
||||||
|
///
|
||||||
/// If an owned `Waker` is needed, `clone()` this one.
|
/// If an owned `Waker` is needed, `clone()` this one.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
@ -796,6 +800,10 @@ pub fn will_wake(&self, other: &LocalWaker) -> bool {
|
|||||||
/// some futures, but are not expecting those futures to wake the waker or
|
/// some futures, but are not expecting those futures to wake the waker or
|
||||||
/// do not need to do anything specific if it happens.
|
/// do not need to do anything specific if it happens.
|
||||||
///
|
///
|
||||||
|
/// More generally, using `LocalWaker::noop()` to poll a future
|
||||||
|
/// means discarding the notification of when the future should be polled again,
|
||||||
|
/// So it should only be used when such a notification will not be needed to make progress.
|
||||||
|
///
|
||||||
/// If an owned `LocalWaker` is needed, `clone()` this one.
|
/// If an owned `LocalWaker` is needed, `clone()` this one.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
Loading…
Reference in New Issue
Block a user