pub trait Store<Meta, Entry> {
// Required methods
fn get(&self) -> Option<&Meta>;
fn set(&mut self, meta: Meta);
fn append(&mut self, entry: Entry) -> Position;
fn read_from(&self, from: Position) -> Vec<&Entry>;
fn end(&self) -> Position;
}Expand description
One value that is replaced, and a sequence that grows.
The split is the point: metadata is small and rewritten, entries accumulate. Rewriting
something that accumulates costs O(n²) over a run, so it must be appended instead.
A protocol that keeps nothing durably declares both types uninhabited, and then set and
append take an argument that cannot be constructed. Reads stay callable and return nothing.
Required Methods§
fn get(&self) -> Option<&Meta>
fn set(&mut self, meta: Meta)
fn append(&mut self, entry: Entry) -> Position
fn read_from(&self, from: Position) -> Vec<&Entry>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".