Skip to main content

ReadOptimized

Trait ReadOptimized 

Source
pub trait ReadOptimized<T: Clone + Send + Sync>: Send + Sync {
    // Required methods
    fn load(&self) -> T;
    fn store(&self, val: T);
}
Expand description

A concurrent store optimized for read-heavy access patterns.

Implementations must guarantee:

  • load() never blocks writers (no writer starvation).
  • load() returns a consistent snapshot (no torn reads).
  • store() is atomic with respect to concurrent load() calls.

Required Methods§

Source

fn load(&self) -> T

Read the current value. Must be wait-free or lock-free.

Source

fn store(&self, val: T)

Atomically replace the stored value.

Implementors§