Struct sero::LockWaiter
source · 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>where
K: Hash + Eq + Clone + Send + Sync + 'static,
impl<K> LockWaiter<K>where
K: Hash + Eq + Clone + Send + Sync + 'static,
sourcepub fn wait(self) -> LockGuard<K>where
K: Hash + Eq + Clone + Send + Sync + 'static,
pub fn wait(self) -> LockGuard<K>where
K: Hash + Eq + Clone + Send + Sync + 'static,
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§
Auto Trait Implementations§
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<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§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