sourcerer-derive

Crates.iosourcerer-derive
lib.rssourcerer-derive
version0.1.2
created_at2025-06-28 16:11:07.177619+00
updated_at2025-06-29 11:31:37.159124+00
descriptionProcedural macros for the sourcerer event-sourcing framework. Provides #[derive(Event)] for automatic event trait implementation.
homepage
repository
max_upload_size
id1729948
size11,779
Liam Woodleigh-Hardinge (liamwh)

documentation

https://docs.rs/sourcerer-derive/latest/sourcerer_derive/

README

sourcerer-derive

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:

  • returns the variant name from event_type().
  • uses the configured 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.

Commit count: 0

cargo fmt