pub trait DistributedLock: Send + Sync {
// Required methods
async fn lock(&self) -> Result<(), LockError>;
async fn try_lock(&self) -> Result<bool, LockError>;
async fn unlock(&self) -> Result<(), LockError>;
async fn lock_with_timeout(
&self,
timeout: Duration,
) -> Result<(), LockError>;
fn key(&self) -> &str;
async fn is_locked(&self) -> bool;
}Expand description
分布式锁 trait (dyn 兼容)
Required Methods§
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.