pub trait StateLockTrait: Send + Sync {
// Required methods
fn read_lock<F, T>(&self, f: F) -> T
where F: FnOnce() -> T;
fn write_lock<F, T>(&self, f: F) -> T
where F: FnOnce() -> T;
}Expand description
简化版状态锁接口(当读写分离不是瓶颈时使用)
Required Methods§
Sourcefn write_lock<F, T>(&self, f: F) -> Twhere
F: FnOnce() -> T,
fn write_lock<F, T>(&self, f: F) -> Twhere
F: FnOnce() -> T,
获取写锁
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".