LockProviderExt

Trait LockProviderExt 

Source
pub trait LockProviderExt: LockProvider {
    // Provided methods
    fn acquire_lock(
        &self,
        name: &str,
        timeout: Option<Duration>,
    ) -> impl Future<Output = Result<<Self::Lock as DistributedLock>::Handle, LockError>> + Send
       where Self: Sync { ... }
    fn try_acquire_lock(
        &self,
        name: &str,
    ) -> impl Future<Output = Result<Option<<Self::Lock as DistributedLock>::Handle>, LockError>> + Send
       where Self: Sync { ... }
}
Expand description

Extension trait providing convenience methods for lock providers.

Provided Methods§

Source

fn acquire_lock( &self, name: &str, timeout: Option<Duration>, ) -> impl Future<Output = Result<<Self::Lock as DistributedLock>::Handle, LockError>> + Send
where Self: Sync,

Acquires a lock by name, returning the handle.

Convenience method combining create_lock and acquire.

Source

fn try_acquire_lock( &self, name: &str, ) -> impl Future<Output = Result<Option<<Self::Lock as DistributedLock>::Handle>, LockError>> + Send
where Self: Sync,

Tries to acquire a lock by name.

Convenience method combining create_lock and try_acquire.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> LockProviderExt for T
where T: LockProvider,