Made from_waker, waker, from_raw const
This commit is contained in:
@@ -186,17 +186,19 @@ pub struct Context<'a> {
|
||||
impl<'a> Context<'a> {
|
||||
/// Create a new `Context` from a [`&Waker`](Waker).
|
||||
#[stable(feature = "futures_api", since = "1.36.0")]
|
||||
#[rustc_const_unstable(feature = "const_waker", issue = "none")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn from_waker(waker: &'a Waker) -> Self {
|
||||
pub const fn from_waker(waker: &'a Waker) -> Self {
|
||||
Context { waker, _marker: PhantomData }
|
||||
}
|
||||
|
||||
/// Returns a reference to the [`Waker`] for the current task.
|
||||
#[stable(feature = "futures_api", since = "1.36.0")]
|
||||
#[rustc_const_unstable(feature = "const_waker", issue = "none")]
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn waker(&self) -> &'a Waker {
|
||||
pub const fn waker(&self) -> &'a Waker {
|
||||
&self.waker
|
||||
}
|
||||
}
|
||||
@@ -311,7 +313,8 @@ impl Waker {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "futures_api", since = "1.36.0")]
|
||||
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
|
||||
#[rustc_const_unstable(feature = "const_waker", issue = "none")]
|
||||
pub const unsafe fn from_raw(waker: RawWaker) -> Waker {
|
||||
Waker { waker }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user