pub struct KMutex<Class: LockClass, M: RawLock = RawMutex> { /* private fields */ }Expand description
A safe, Zircon-compatible mutual exclusion lock supporting compile-time order validation.
KMutex wraps a platform-specific RawLock abstraction. It is pinned in memory to support FFI
loop-detector active list registrations safely under the lock class Class.
Implementations§
Source§impl<Class: LockClass, M: RawLock> KMutex<Class, M>
impl<Class: LockClass, M: RawLock> KMutex<Class, M>
Sourcepub fn init() -> impl PinInit<Self, Infallible>
pub fn init() -> impl PinInit<Self, Infallible>
Safe dynamic initialization of the validation lock inside pin context.
Sourcepub fn lock(&self) -> impl PinInit<KMutexGuard<'_, Class, M>, Infallible>
pub fn lock(&self) -> impl PinInit<KMutexGuard<'_, Class, M>, Infallible>
Acquires the lock, using the default policy, and registers the active loop node.
Sourcepub fn lock_with(
&self,
args: <<M as RawLock>::DefaultPolicy as LockPolicy<M>>::AcquireArgs,
) -> impl PinInit<KMutexGuard<'_, Class, M>, Infallible>
pub fn lock_with( &self, args: <<M as RawLock>::DefaultPolicy as LockPolicy<M>>::AcquireArgs, ) -> impl PinInit<KMutexGuard<'_, Class, M>, Infallible>
Acquires the lock with arguments, using the default policy, and registers the active loop node.
Sourcepub fn lock_policy<P: LockPolicy<M, AcquireArgs = ()>>(
&self,
) -> impl PinInit<KMutexGuard<'_, Class, M, P>, Infallible>
pub fn lock_policy<P: LockPolicy<M, AcquireArgs = ()>>( &self, ) -> impl PinInit<KMutexGuard<'_, Class, M, P>, Infallible>
Acquires the lock, using the specified policy, and registers the active loop node.
Sourcepub fn lock_policy_with<P: LockPolicy<M>>(
&self,
args: P::AcquireArgs,
) -> impl PinInit<KMutexGuard<'_, Class, M, P>, Infallible>
pub fn lock_policy_with<P: LockPolicy<M>>( &self, args: P::AcquireArgs, ) -> impl PinInit<KMutexGuard<'_, Class, M, P>, Infallible>
Acquires the lock with arguments, using the specified policy, and registers the active loop node.
Sourcepub fn aliased_lock<'a, AliasClass: LockClass, M2: RawLock>(
&'a self,
alias: &'a KMutex<AliasClass, M2>,
) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2>, Infallible>
pub fn aliased_lock<'a, AliasClass: LockClass, M2: RawLock>( &'a self, alias: &'a KMutex<AliasClass, M2>, ) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2>, Infallible>
Acquires this lock and aliases it with alias, returning a guard that proves ownership
of both Class and AliasClass.
Sourcepub fn aliased_lock_with<'a, AliasClass: LockClass, M2: RawLock>(
&'a self,
alias: &'a KMutex<AliasClass, M2>,
args: <<M as RawLock>::DefaultPolicy as LockPolicy<M>>::AcquireArgs,
) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2>, Infallible>
pub fn aliased_lock_with<'a, AliasClass: LockClass, M2: RawLock>( &'a self, alias: &'a KMutex<AliasClass, M2>, args: <<M as RawLock>::DefaultPolicy as LockPolicy<M>>::AcquireArgs, ) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2>, Infallible>
Acquires this lock with arguments and aliases it with alias, returning a guard that proves
ownership of both Class and AliasClass.
Sourcepub fn aliased_lock_policy<'a, AliasClass: LockClass, M2: RawLock, P: LockPolicy<M, AcquireArgs = ()>>(
&'a self,
alias: &'a KMutex<AliasClass, M2>,
) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2, P>, Infallible>
pub fn aliased_lock_policy<'a, AliasClass: LockClass, M2: RawLock, P: LockPolicy<M, AcquireArgs = ()>>( &'a self, alias: &'a KMutex<AliasClass, M2>, ) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2, P>, Infallible>
Acquires this lock with policy P and aliases it with alias.
Sourcepub fn aliased_lock_policy_with<'a, AliasClass: LockClass, M2: RawLock, P: LockPolicy<M>>(
&'a self,
alias: &'a KMutex<AliasClass, M2>,
args: P::AcquireArgs,
) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2, P>, Infallible>
pub fn aliased_lock_policy_with<'a, AliasClass: LockClass, M2: RawLock, P: LockPolicy<M>>( &'a self, alias: &'a KMutex<AliasClass, M2>, args: P::AcquireArgs, ) -> impl PinInit<KMutexAliasedGuard<'a, Class, AliasClass, M, M2, P>, Infallible>
Acquires this lock with policy P and arguments and aliases it with alias.
Trait Implementations§
Auto Trait Implementations§
impl<Class, M> Freeze for KMutex<Class, M>where
M: Freeze,
impl<Class, M> RefUnwindSafe for KMutex<Class, M>where
M: RefUnwindSafe,
Class: RefUnwindSafe,
impl<Class, M> Send for KMutex<Class, M>where
M: Send,
Class: Send,
impl<Class, M> Sync for KMutex<Class, M>where
M: Sync,
Class: Sync,
impl<Class, M> UnsafeUnpin for KMutex<Class, M>where
M: UnsafeUnpin,
impl<Class, M> UnwindSafe for KMutex<Class, M>where
M: UnwindSafe,
Class: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>
slot. Read moreSource§fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
self then calls the function f with the initialized
value. Read more