pub struct KeyLock<K> { /* private fields */ }
Expand description
Implementations§
Source§impl<K> KeyLock<K>
impl<K> KeyLock<K>
Sourcepub async fn lock(&self, key: K) -> OwnedMutexGuard<()>
pub async fn lock(&self, key: K) -> OwnedMutexGuard<()>
Lock this key, returning a guard. Cleans up locks every 1000 accesses.
Sourcepub async fn try_lock(
&self,
key: K,
) -> Result<OwnedMutexGuard<()>, TryLockError>
pub async fn try_lock( &self, key: K, ) -> Result<OwnedMutexGuard<()>, TryLockError>
Try lock this key, returning immediately. Cleans up locks every 1000 accesses.
Sourcepub fn blocking_lock(&self, key: K) -> OwnedMutexGuard<()>
pub fn blocking_lock(&self, key: K) -> OwnedMutexGuard<()>
Lock this key blockingly, returning a guard. Cleans up locks every 1000 accesses.
Sourcepub fn blocking_try_lock(
&self,
key: K,
) -> Result<OwnedMutexGuard<()>, TryLockError>
pub fn blocking_try_lock( &self, key: K, ) -> Result<OwnedMutexGuard<()>, TryLockError>
Try lock this key blockingly, returning immediately. Cleans up locks every 1000 accesses.
Sourcepub fn blocking_clean(&self)
pub fn blocking_clean(&self)
Cleanu up by removing locks that are not locked, but lock blockingly.
Trait Implementations§
Auto Trait Implementations§
impl<K> !Freeze for KeyLock<K>
impl<K> !RefUnwindSafe for KeyLock<K>
impl<K> Send for KeyLock<K>where
K: Send,
impl<K> Sync for KeyLock<K>where
K: Send,
impl<K> Unpin for KeyLock<K>where
K: Unpin,
impl<K> !UnwindSafe for KeyLock<K>
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