Enum async_local::WithLocal
source · pub enum WithLocal<T, F, R>where
T: AsContext + 'static,
F: for<'a> FnOnce(RefGuard<'a, T::Target>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>>,{
Uninitialized {
f: F,
key: &'static LocalKey<T>,
},
Initializing {
_marker: PhantomData<R>,
},
Pending(Pin<Box<dyn Future<Output = R> + Send>>),
}
Expand description
A Future with a reference to a thread local Context
that’s usable across await points
Variants§
Uninitialized
Initializing
Fields
§
_marker: PhantomData<R>
Pending(Pin<Box<dyn Future<Output = R> + Send>>)
Trait Implementations§
source§impl<T, F, R> Future for WithLocal<T, F, R>where
T: AsContext,
F: for<'a> FnOnce(RefGuard<'a, T::Target>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>>,
impl<T, F, R> Future for WithLocal<T, F, R>where T: AsContext, F: for<'a> FnOnce(RefGuard<'a, T::Target>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>>,
impl<'pin, T, F, R> Unpin for WithLocal<T, F, R>where T: AsContext + 'static, F: for<'a> FnOnce(RefGuard<'a, T::Target>) -> Pin<Box<dyn Future<Output = R> + Send + 'a>>, __WithLocal<'pin, T, F, R>: Unpin,
Auto Trait Implementations§
impl<T, F, R> !RefUnwindSafe for WithLocal<T, F, R>
impl<T, F, R> Send for WithLocal<T, F, R>where F: Send, R: Send,
impl<T, F, R> !Sync for WithLocal<T, F, R>
impl<T, F, R> !UnwindSafe for WithLocal<T, F, R>
Blanket Implementations§
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more