pub struct ContextBuilder<'a> { /* private fields */ }
local_waker #118959)
A Builder used to construct a Context instance with support for LocalWaker.
#![feature(local_waker)]
use std::task::{ContextBuilder, LocalWaker, Waker, Poll};
use std::future::Future;
let local_waker = LocalWaker::noop();
let waker = Waker::noop();
let mut cx = ContextBuilder::from_waker(&waker)
.local_waker(&local_waker)
.build();
let mut future = std::pin::pin!(async { 20 });
let poll = future.as_mut().poll(&mut cx);
assert_eq!(poll, Poll::Ready(20));
impl<'a> ContextBuilder<'a>
pub const fn from_waker(waker: &'a Waker) -> ContextBuilder<'a>
local_waker #118959)
Creates a ContextBuilder from a Waker.
pub const fn from(cx: &'a mut Context<'_>) -> ContextBuilder<'a>
context_ext #123392)
Creates a ContextBuilder from an existing Context.
pub const fn waker(self, waker: &'a Waker) -> ContextBuilder<'a>
context_ext #123392)
Sets the value for the waker on Context.
pub const fn local_waker(
self,
local_waker: &'a LocalWaker,
) -> ContextBuilder<'a>local_waker #118959)
Sets the value for the local waker on Context.
pub const fn ext(self, data: &'a mut (dyn Any + 'static)) -> ContextBuilder<'a>
context_ext #123392)
Sets the value for the extension data on Context.
pub const fn build(self) -> Context<'a>
local_waker #118959)
Builds the Context.
impl<'a> Debug for ContextBuilder<'a>
impl<'a> Freeze for ContextBuilder<'a>
impl<'a> !RefUnwindSafe for ContextBuilder<'a>
impl<'a> !Send for ContextBuilder<'a>
impl<'a> !Sync for ContextBuilder<'a>
impl<'a> Unpin for ContextBuilder<'a>
impl<'a> !UnwindSafe for ContextBuilder<'a>
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/task/struct.ContextBuilder.html