Skip to main content

StateLockTrait

Trait StateLockTrait 

Source
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§

Source

fn read_lock<F, T>(&self, f: F) -> T
where F: FnOnce() -> T,

获取读锁

Source

fn write_lock<F, T>(&self, f: F) -> T
where F: FnOnce() -> T,

获取写锁

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§