diff options
| author | Tomás Vallotton <tvallotton@uc.cl> | 2023-12-14 23:15:27 -0300 |
|---|---|---|
| committer | Tomás Vallotton <tvallotton@uc.cl> | 2024-01-20 10:14:25 -0300 |
| commit | f82437396fe2d21ae73134a6faa6c58bd03d96e4 (patch) | |
| tree | 476269d3c20d4d241555e34c9a1542f3871f3ec7 | |
| parent | 0cb7a0a90ef5862b87083546accb12467b279eb2 (diff) | |
| download | rust-f82437396fe2d21ae73134a6faa6c58bd03d96e4.tar.gz rust-f82437396fe2d21ae73134a6faa6c58bd03d96e4.zip | |
feat: impl AsRef<LocalWaker> for Waker.
| -rw-r--r-- | library/core/src/task/wake.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index c02504b386e..e90994df0c7 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -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 { |
