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