pub trait ProjectionFilters: Sized {
type Id;
type InstanceId;
type Metadata;
// Required methods
fn init(instance_id: &Self::InstanceId) -> Self;
fn filters<S>(instance_id: &Self::InstanceId) -> Filters<S, Self>
where S: EventStore<Id = Self::Id, Metadata = Self::Metadata>;
}Expand description
Base trait for types that subscribe to events.
The filters() method returns both the event filters AND the handlers
needed to process those events. It is generic over the store type S,
allowing the same projection to work with any store that shares the
same Id and Metadata types.
filters() must be pure and deterministic: given the same
instance_id, it must always return the same filter set.
init() constructs a fresh instance from the instance identifier.
This replaces the Default constraint, allowing instance-aware
projections to capture their identity at construction time.
Required Associated Types§
Sourcetype InstanceId
type InstanceId
Instance identifier for this subscriber.
For singleton subscribers use ().
Required Methods§
Sourcefn init(instance_id: &Self::InstanceId) -> Self
fn init(instance_id: &Self::InstanceId) -> Self
Construct a fresh instance from the instance identifier.
For singleton projections (InstanceId = ()), this typically
delegates to Self::default(). For instance projections, this
captures the instance identifier at construction time.
Sourcefn filters<S>(instance_id: &Self::InstanceId) -> Filters<S, Self>
fn filters<S>(instance_id: &Self::InstanceId) -> Filters<S, Self>
Build the filter set and handler map for this subscriber.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.