pub struct KeyRwLock<K> { /* private fields */ }Expand description
Implementations§
Source§impl<K> KeyRwLock<K>
impl<K> KeyRwLock<K>
Sourcepub async fn read(&self, key: K) -> OwnedRwLockReadGuard<()>
pub async fn read(&self, key: K) -> OwnedRwLockReadGuard<()>
Lock this key with shared read access, returning a guard. Cleans up locks every 1000 accesses.
Sourcepub async fn write(&self, key: K) -> OwnedRwLockWriteGuard<()>
pub async fn write(&self, key: K) -> OwnedRwLockWriteGuard<()>
Lock this key with exclusive write access, returning a guard. Cleans up locks every 1000 accesses.
Sourcepub async fn try_read(
&self,
key: K,
) -> Result<OwnedRwLockReadGuard<()>, TryLockError>
pub async fn try_read( &self, key: K, ) -> Result<OwnedRwLockReadGuard<()>, TryLockError>
Try lock this key with shared read access, returning immediately. Cleans up locks every 1000 accesses.
Sourcepub async fn try_write(
&self,
key: K,
) -> Result<OwnedRwLockWriteGuard<()>, TryLockError>
pub async fn try_write( &self, key: K, ) -> Result<OwnedRwLockWriteGuard<()>, TryLockError>
Try lock this key with exclusive write access, returning immediately. Cleans up locks every 1000 accesses.
Trait Implementations§
Auto Trait Implementations§
impl<K> !Freeze for KeyRwLock<K>
impl<K> !RefUnwindSafe for KeyRwLock<K>
impl<K> Send for KeyRwLock<K>where
K: Send,
impl<K> Sync for KeyRwLock<K>where
K: Send,
impl<K> Unpin for KeyRwLock<K>where
K: Unpin,
impl<K> !UnwindSafe for KeyRwLock<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