pub trait Projection<E>: Default {
// Required method
fn apply(&mut self, event: &StoredEvent<E>) -> Result<()>;
// Provided methods
fn prepare_replay(&mut self, _events: &[StoredEvent<E>]) { ... }
fn apply_owned(&mut self, event: StoredEvent<E>) -> Result<()> { ... }
}Required Methods§
Provided Methods§
Sourcefn prepare_replay(&mut self, _events: &[StoredEvent<E>])
fn prepare_replay(&mut self, _events: &[StoredEvent<E>])
Reserves projection-specific capacity before a known replay batch.
The default is a no-op. Implementations must not mutate observable projection state or weaken validation.
Sourcefn apply_owned(&mut self, event: StoredEvent<E>) -> Result<()>
fn apply_owned(&mut self, event: StoredEvent<E>) -> Result<()>
Applies one owned event. The default preserves the borrowed contract; projections may override it to move large payloads without cloning.
§Errors
Returns the same invariant violations as Self::apply.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".