Skip to main content

Crate eventide_macros

Crate eventide_macros 

Source
Expand description

Procedural macros for the eventide Domain-Driven Design / CQRS toolkit.

This crate provides four attribute macros that remove boilerplate when modelling DDD building blocks in Rust:

MacroApplies toPurpose
[entity]struct (named)Mark a type as a DDD entity / aggregate root.
[entity_id]tuple structNewtype wrapper around a primitive ID with a rich set of conversions.
[domain_event]enum (named fields)Tag an enum as the event family for an aggregate.
[value_object]struct or enumAdd the standard derive set expected of immutable value objects.

Each macro lives in its own module; this crate root only re-exports the procedural-macro entry points and forwards to the per-macro expand function. See the documentation on each macro for the supported attribute arguments and concrete examples.

Attribute Macrosยง

domain_event
Tag an enum as the domain-event family for an aggregate.
entity
Mark a struct as a DDD entity / aggregate root.
entity_id
Turn a single-field tuple struct into a fully-featured entity-ID newtype.
value_object
Add the conventional derive set for an immutable value object.