pub struct LockGuard { /* private fields */ }Expand description
Backend-agnostic RAII lock guard.
Wraps Arc<dyn Lock> and releases via the trait’s release() method.
On drop without explicit release, spawns a tokio task for async cleanup.
Implementations§
Source§impl LockGuard
impl LockGuard
Sourcepub async fn acquire(
lock: Arc<dyn Lock>,
namespace: &str,
resource_id: &str,
) -> Result<Self>
pub async fn acquire( lock: Arc<dyn Lock>, namespace: &str, resource_id: &str, ) -> Result<Self>
Acquire a lock and return a guard that auto-releases on drop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LockGuard
impl !RefUnwindSafe for LockGuard
impl Send for LockGuard
impl Sync for LockGuard
impl Unpin for LockGuard
impl UnsafeUnpin for LockGuard
impl !UnwindSafe for LockGuard
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