Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc. #118960

Merged
merged 16 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: impl AsRef<LocalWaker> for Waker.
tvallotton committed Jan 20, 2024
commit f82437396fe2d21ae73134a6faa6c58bd03d96e4
8 changes: 8 additions & 0 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
@@ -769,6 +769,14 @@ impl Clone for LocalWaker {
}
}

#[unstable(feature = "local_waker", issue = "118959")]
impl AsRef<LocalWaker> for Waker {
fn as_ref(&self) -> &LocalWaker {
// SAFETY: LocalWaker is just Waker without thread safety
unsafe { transmute(self) }
}
}

#[stable(feature = "futures_api", since = "1.36.0")]
impl fmt::Debug for LocalWaker {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {