| Crates.io | sourcerer-derive |
| lib.rs | sourcerer-derive |
| version | 0.1.2 |
| created_at | 2025-06-28 16:11:07.177619+00 |
| updated_at | 2025-06-29 11:31:37.159124+00 |
| description | Procedural macros for the sourcerer event-sourcing framework. Provides #[derive(Event)] for automatic event trait implementation. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1729948 |
| size | 11,779 |
Procedural macros for the sourcerer event-sourcing framework.
Currently it provides a single derive macro:
#[derive(Event)]Implements the sourcerer::Event trait for enums and supports the #[event(...)] helper attribute.
use serde::{Serialize, Deserialize};
use sourcerer_derive::Event;
#[derive(Serialize, Deserialize, Event)]
#[event(version = 2, source = "urn:my-service")]
enum AccountEvent {
Opened,
#[event(version = 3)]
Credited { amount: u64 },
#[event(source = "urn:custom")]
Debited(u64),
}
The generated implementation:
event_type().version/source, with per-variant overrides.Add the macro via the re-exported derive feature on sourcerer, or depend directly:
[dependencies]
sourcerer-derive = "0.1"
Licensed under MIT – see LICENSE.