pub trait ProjectionAggregate: ProjectionCursor {
// Required method
fn aggregate_id(&self) -> String;
// Provided methods
fn aggregate_version(&self) -> Result<u16> { ... }
fn write(&self) -> Result<WriteBuilder> { ... }
}Expand description
Trait for projections that can create a WriteBuilder.
Extends ProjectionCursor to provide aggregate identity and versioning,
enabling projections to emit new events.
Required Methods§
Sourcefn aggregate_id(&self) -> String
fn aggregate_id(&self) -> String
Returns the aggregate ID for this projection.
Implementors must return the stable identity of the aggregate this projection represents (typically a field populated from the first event).
Provided Methods§
Sourcefn aggregate_version(&self) -> Result<u16>
fn aggregate_version(&self) -> Result<u16>
Returns the current aggregate version from the cursor.
Returns 0 if no cursor is set.
Sourcefn write(&self) -> Result<WriteBuilder>
fn write(&self) -> Result<WriteBuilder>
Creates a WriteBuilder pre-configured with this projection’s ID and version.
Use this to emit new events from a projection (the write gateway).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".