pub struct LockWaiter<K>{ /* private fields */ }Expand description
A LockWaiter represents a waiter waiting to access a lock on a key.
The LockWaiter can be consumed synchronously using LockWaiter::wait (which will park the current thread until it is available) or asynchronously through .await.
§Example:
let waiter = store.lock("test");
let guard = waiter.wait();
// OR
let guard = waiter.await;Implementations§
Source§impl<K> LockWaiter<K>
impl<K> LockWaiter<K>
Sourcepub fn wait(self) -> LockGuard<K>
pub fn wait(self) -> LockGuard<K>
Wait for the lock to be available and acquire a guard, when the guard is dropped the lock is released and can be acquired again Note: Calling this method will park the current thread, this may cause issues, especially in an asynchronous context, and cause a deadlock.
§Example
let waiter = store.lock("test");
let guard = waiter.wait();Trait Implementations§
Source§impl<K> Clone for LockWaiter<K>
impl<K> Clone for LockWaiter<K>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<K> Debug for LockWaiter<K>
impl<K> Debug for LockWaiter<K>
Source§impl<K> Future for LockWaiter<K>
impl<K> Future for LockWaiter<K>
Auto Trait Implementations§
impl<K> Freeze for LockWaiter<K>where
K: Freeze,
impl<K> !RefUnwindSafe for LockWaiter<K>
impl<K> Send for LockWaiter<K>
impl<K> Sync for LockWaiter<K>
impl<K> Unpin for LockWaiter<K>where
K: Unpin,
impl<K> !UnwindSafe for LockWaiter<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more