Skip to content

Commit

Permalink
LocalWaker docs: Make long-ago omitted but probably intended changes
Browse files Browse the repository at this point in the history
In 6f8a944, titled

  Change return type of unstable `Waker::noop()` from `Waker` to `&Waker`.

the summary line for Waker was changed:

  -    /// Creates a new `Waker` that does nothing when `wake` is called.
  +    /// Returns a reference to a `Waker` that does nothing when used.

and the sentence about clone was added.

LocalWaker's docs were not changed, even though the types were, but
there is no explanation for why not.  It seems like it was simply a
slip induced by the clone-and-hack.
  • Loading branch information
ijackson committed Jul 22, 2024
1 parent c4fdac9 commit 971aa37
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ impl LocalWaker {
Self { waker }
}

/// Creates a new `LocalWaker` that does nothing when `wake` is called.
/// Returns a reference to a `LocalWaker` that does nothing when used.
///
// Note! Much of the documentation for this method is duplicated
// in the docs for `Waker::noop`.
Expand All @@ -796,6 +796,8 @@ impl LocalWaker {
/// some futures, but are not expecting those futures to wake the waker or
/// do not need to do anything specific if it happens.
///
/// If an owned `LocalWaker` is needed, `clone()` this one.
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit 971aa37

Please sign in to comment.