Expand description
§Seesaw
A deterministic event/handler runtime with TypeId-based multi-event dispatch.
§Guarantees
- Multi-event dispatch: Support for multiple event types via TypeId routing.
- Handler system: Register handlers that react to events and can emit new events and access shared dependencies.
§Example
ⓘ
use seesaw::{Engine, on};
// Define event types (struct-per-event pattern)
#[derive(Clone)]
struct UserCreated { name: String }
#[derive(Clone)]
struct UserWelcomed { name: String }
// Create engine with handlers
let engine = Engine::in_memory(deps)
.with_handler(on::<UserCreated>().then(|event, _ctx| async move {
println!("User created: {}", event.name);
Ok(UserWelcomed { name: event.name.clone() })
}));
// Emit + settle the full causal tree.
engine.emit(UserCreated { name: "Alice".into() }).settled().await?;Re-exports§
pub use event::Event;pub use aggregator::Aggregate;pub use aggregator::Aggregator;pub use aggregator::AggregatorRegistry;pub use aggregator::Apply;pub use event_store::event_type_short_name;pub use event_store::persist_event;pub use event_store::save_snapshot;pub use event_store::Versioned;pub use types::AppendResult;pub use types::NewEvent;pub use types::PersistedEvent;pub use types::QueueStatus;pub use types::Snapshot;pub use event_log::EventLog;pub use handler_queue::HandlerQueue;pub use types::EventPark;pub use types::IntentCommit;pub use memory_store::MemoryStore;pub use upcaster::Upcaster;pub use upcaster::UpcasterRegistry;pub use handler::AggregateState;pub use handler::AnyEvent;pub use handler::Context;pub use handler::DlqTerminalInfo;pub use handler::Emit;pub use handler::ErrorContext;pub use handler::EventOutput;pub use handler::Events;pub use handler::Handler;pub use handler::HandlerError;pub use handler::IntoEvents;pub use handler::Logger;pub use handler::Projection;pub use job_executor::HandlerResult;pub use job_executor::HandlerStatus;pub use job_executor::JobExecutor;pub use types::EmittedEvent;pub use types::EventWorkerConfig;pub use types::HandlerCompletion;pub use types::HandlerDlq;pub use types::HandlerIntent;pub use types::HandlerResolution;pub use types::HandlerWorkerConfig;pub use types::JournalEntry;pub use types::LogEntry;pub use types::LogLevel;pub use types::ProjectionFailure;pub use types::QueuedHandler;pub use types::NAMESPACE_SEESAW;pub use handler::on;pub use handler::on_any;pub use handler::project;
Modules§
- aggregator
- Aggregator registry — manages aggregate definitions and state.
- event
- The
Eventtrait — compile-time event identity for durable naming. - event_
log - Durable event log trait.
- event_
store - Event-sourcing helpers and aggregate utilities.
- handler
- Handler system with builder API.
- handler_
queue - Handler work-distribution queue trait.
- job_
executor - JobExecutor - extracted handler execution logic from workers
- memory_
store - In-memory EventLog + HandlerQueue for seesaw Engine.
- types
- Core data types for seesaw event processing.
- upcaster
- Upcaster registry for event schema evolution.
Macros§
- events
- The universal return macro for all handlers.
Structs§
- Emit
Future - Future returned by
Engine::emit(). - Engine
- Store-agnostic Engine with built-in settle loop.
- Process
Handle - Handle returned after an event is published.
- Settle
Future - Future for synchronous settlement.
Attribute Macros§
- aggregator
- Marks a function as an aggregator — generates
impl Apply<E> for Aand anAggregatorfactory. - aggregators
- Collects
#[aggregator]functions in a module into afn aggregators() -> Vec<Aggregator>. - event
- Marks a type as a seesaw Event, generating a
seesaw_core::event::Eventimpl. - handle
- handler
- handlers
- handles
- projection
- Marks a function as a projection — receives all events as
AnyEvent, returnsResult<()>.