#[derive(Projection)]
{
// Attributes available to this derive:
#[projection]
}
Expand description
Derives the Projection trait for a struct.
This macro always generates:
Projectiontrait implementation withKINDconstant
It can also generate [ProjectionFilters] for the common case via
events(...) (or explicit id / instance_id / metadata
attributes), using Default for initialisation and a simple
Filters::new().event::<E>()... filter set.
§Attributes
§Optional
kind = "name"- Projection type identifier (default: kebab-case struct name)events(Event1, Event2, ...)- Auto-generateProjectionFilters::filterswith global event subscriptions.id = Type- OverrideProjectionFilters::Id(default:Stringwhen auto-generatingProjectionFilters)instance_id = Type- OverrideProjectionFilters::InstanceId(default:()when auto-generatingProjectionFilters)metadata = Type- OverrideProjectionFilters::Metadata(default:()when auto-generatingProjectionFilters)
§Example
ⓘ
#[derive(Default, Projection)]
pub struct AccountLedger {
total: i64,
}