pub trait LockProviderExt: LockProvider {
// Provided methods
fn acquire_lock(
&self,
name: &str,
timeout: Option<Duration>,
) -> impl Future<Output = LockResult<<Self::Lock as DistributedLock>::Handle>> + Send
where Self: Sync { ... }
fn try_acquire_lock(
&self,
name: &str,
) -> impl Future<Output = LockResult<Option<<Self::Lock as DistributedLock>::Handle>>> + Send
where Self: Sync { ... }
}Expand description
Extension trait providing convenience methods for lock providers.
Provided Methods§
Sourcefn acquire_lock(
&self,
name: &str,
timeout: Option<Duration>,
) -> impl Future<Output = LockResult<<Self::Lock as DistributedLock>::Handle>> + Sendwhere
Self: Sync,
fn acquire_lock(
&self,
name: &str,
timeout: Option<Duration>,
) -> impl Future<Output = LockResult<<Self::Lock as DistributedLock>::Handle>> + Sendwhere
Self: Sync,
Acquires a lock by name, returning the handle.
Convenience method combining create_lock and acquire.
Sourcefn try_acquire_lock(
&self,
name: &str,
) -> impl Future<Output = LockResult<Option<<Self::Lock as DistributedLock>::Handle>>> + Sendwhere
Self: Sync,
fn try_acquire_lock(
&self,
name: &str,
) -> impl Future<Output = LockResult<Option<<Self::Lock as DistributedLock>::Handle>>> + Sendwhere
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.