Struct wasmer_wasix::journal::effector::MutexGuard
1.0.0 · source · pub(in journal) struct MutexGuard<'a, T>where
T: 'a + ?Sized,{
lock: &'a Mutex<T>,
poison: Guard,
}
Expand description
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
The data protected by the mutex can be accessed through this guard via its
Deref
and DerefMut
implementations.
This structure is created by the lock
and try_lock
methods on
Mutex
.
Fields§
§lock: &'a Mutex<T>
§poison: Guard
Implementations§
source§impl<'a, T> MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> MutexGuard<'a, T>where
T: ?Sized,
sourcepub fn map<U, F>(orig: MutexGuard<'a, T>, f: F) -> MappedMutexGuard<'a, U>
🔬This is a nightly-only experimental API. (mapped_lock_guards
)
pub fn map<U, F>(orig: MutexGuard<'a, T>, f: F) -> MappedMutexGuard<'a, U>
mapped_lock_guards
)Makes a MappedMutexGuard
for a component of the borrowed data, e.g.
an enum variant.
The Mutex
is already locked, so this cannot fail.
This is an associated function that needs to be used as
MutexGuard::map(...)
. A method would interfere with methods of the
same name on the contents of the MutexGuard
used through Deref
.
sourcepub fn try_map<U, F>(
orig: MutexGuard<'a, T>,
f: F,
) -> Result<MappedMutexGuard<'a, U>, MutexGuard<'a, T>>
🔬This is a nightly-only experimental API. (mapped_lock_guards
)
pub fn try_map<U, F>( orig: MutexGuard<'a, T>, f: F, ) -> Result<MappedMutexGuard<'a, U>, MutexGuard<'a, T>>
mapped_lock_guards
)Makes a MappedMutexGuard
for a component of the borrowed data. The
original guard is returned as an Err(...)
if the closure returns
None
.
The Mutex
is already locked, so this cannot fail.
This is an associated function that needs to be used as
MutexGuard::try_map(...)
. A method would interfere with methods of the
same name on the contents of the MutexGuard
used through Deref
.
Trait Implementations§
1.16.0 · source§impl<T> Debug for MutexGuard<'_, T>
impl<T> Debug for MutexGuard<'_, T>
1.0.0 · source§impl<T> DerefMut for MutexGuard<'_, T>where
T: ?Sized,
impl<T> DerefMut for MutexGuard<'_, T>where
T: ?Sized,
1.20.0 · source§impl<T> Display for MutexGuard<'_, T>
impl<T> Display for MutexGuard<'_, T>
1.0.0 · source§impl<T> Drop for MutexGuard<'_, T>where
T: ?Sized,
impl<T> Drop for MutexGuard<'_, T>where
T: ?Sized,
1.0.0 · source§impl<T> Deref for MutexGuard<'_, T>where
T: ?Sized,
impl<T> Deref for MutexGuard<'_, T>where
T: ?Sized,
impl<T> !Send for MutexGuard<'_, T>where
T: ?Sized,
impl<'a, T> StableDeref for MutexGuard<'a, T>where
T: ?Sized,
impl<T> Sync for MutexGuard<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> RefUnwindSafe for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> Unpin for MutexGuard<'a, T>where
T: ?Sized,
impl<'a, T> UnwindSafe for MutexGuard<'a, T>where
T: ?Sized,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<P> AsEngineRef for P
impl<P> AsEngineRef for P
§fn as_engine_ref(&self) -> EngineRef<'_>
fn as_engine_ref(&self) -> EngineRef<'_>
EngineRef
pointing to the underlying context.§fn maybe_as_store(&self) -> Option<StoreRef<'_>>
fn maybe_as_store(&self) -> Option<StoreRef<'_>>
StoreRef
is the passed reference is a Store
.§impl<P> AsStoreMut for P
impl<P> AsStoreMut for P
§fn as_store_mut(&mut self) -> StoreMut<'_>
fn as_store_mut(&mut self) -> StoreMut<'_>
StoreMut
pointing to the underlying context.§fn objects_mut(&mut self) -> &mut StoreObjects
fn objects_mut(&mut self) -> &mut StoreObjects
§impl<P> AsStoreRef for P
impl<P> AsStoreRef for P
§fn as_store_ref(&self) -> StoreRef<'_>
fn as_store_ref(&self) -> StoreRef<'_>
StoreRef
pointing to the underlying context.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
source§impl<D, C> HttpClient for D
impl<D, C> HttpClient for D
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
§impl<T> Upcastable for T
impl<T> Upcastable for T
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_box(self: Box<T>) -> Box<dyn Any>
source§impl<D, T> VirtualTaskManagerExt for D
impl<D, T> VirtualTaskManagerExt for D
source§fn spawn_and_block_on<A>(
&self,
task: impl Future<Output = A> + Send + 'static,
) -> Result<A, Error>where
A: Send + 'static,
fn spawn_and_block_on<A>(
&self,
task: impl Future<Output = A> + Send + 'static,
) -> Result<A, Error>where
A: Send + 'static,
Runs the work in the background via the task managers shared background threads while blocking the current execution until it finishs