Struct async_local::LocalRef
source · pub struct LocalRef<'id, T: Sync + 'static> { /* private fields */ }
Expand description
A thread-safe pointer to a thread-local Context
constrained by a “generative” lifetime brand that is invariant over the lifetime parameter and cannot be coerced into 'static
Implementations§
source§impl<'id, T> LocalRef<'id, T>where
T: Sync + 'static,
impl<'id, T> LocalRef<'id, T>where
T: Sync + 'static,
sourcepub fn with_blocking<F, R>(self, f: F) -> JoinHandle<R>
Available on crate features tokio-runtime
or barrier-protected-runtime
only.
pub fn with_blocking<F, R>(self, f: F) -> JoinHandle<R>
tokio-runtime
or barrier-protected-runtime
only.A wrapper around tokio::task::spawn_blocking
that safely constrains the lifetime of LocalRef
Trait Implementations§
source§impl<'id, T: Ord + Sync + 'static> Ord for LocalRef<'id, T>
impl<'id, T: Ord + Sync + 'static> Ord for LocalRef<'id, T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'id, T: PartialEq + Sync + 'static> PartialEq for LocalRef<'id, T>
impl<'id, T: PartialEq + Sync + 'static> PartialEq for LocalRef<'id, T>
source§impl<'id, T: PartialOrd + Sync + 'static> PartialOrd for LocalRef<'id, T>
impl<'id, T: PartialOrd + Sync + 'static> PartialOrd for LocalRef<'id, T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'id, T> Copy for LocalRef<'id, T>where
T: Sync + 'static,
impl<'id, T: Eq + Sync + 'static> Eq for LocalRef<'id, T>
impl<'id, T> Send for LocalRef<'id, T>where
T: Sync,
impl<'id, T: Sync + 'static> StructuralEq for LocalRef<'id, T>
impl<'id, T: Sync + 'static> StructuralPartialEq for LocalRef<'id, T>
impl<'id, T> Sync for LocalRef<'id, T>where
T: Sync,
Auto Trait Implementations§
impl<'id, T> RefUnwindSafe for LocalRef<'id, T>where
T: RefUnwindSafe,
impl<'id, T> Unpin for LocalRef<'id, T>
impl<'id, T> UnwindSafe for LocalRef<'id, T>where
T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more