Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f824373

Browse files
committed
feat: impl AsRef<LocalWaker> for Waker.
1 parent 0cb7a0a commit f824373

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/core/src/task/wake.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,14 @@ impl Clone for LocalWaker {
769769
}
770770
}
771771

772+
#[unstable(feature = "local_waker", issue = "118959")]
773+
impl AsRef<LocalWaker> for Waker {
774+
fn as_ref(&self) -> &LocalWaker {
775+
// SAFETY: LocalWaker is just Waker without thread safety
776+
unsafe { transmute(self) }
777+
}
778+
}
779+
772780
#[stable(feature = "futures_api", since = "1.36.0")]
773781
impl fmt::Debug for LocalWaker {
774782
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

0 commit comments

Comments
 (0)