hexeract_core/lib.rs
1//! Core traits and types for the Hexeract messaging framework.
2//!
3//! This crate is the cross-cutting foundation that every other Hexeract
4//! crate depends on. It defines the marker traits for messages
5//! ([`Command`], [`Query`], [`Notification`]), the matching handler
6//! traits ([`CommandHandler`], [`QueryHandler`], [`NotificationHandler`]),
7//! the [`MessageEnvelope`] and [`HandlerContext`] passed alongside every
8//! dispatch, the [`Middleware`] / [`Next`] / [`Terminal`] pipeline
9//! primitives, the unified [`HexeractError`] type, and the
10//! [`HandlerRegistration`] metadata collected by the `#[handler]` macro.
11
12/// Marker trait for messages expressing the intent to mutate state.
13pub mod command;
14/// Contextual information propagated into every handler invocation.
15pub mod context;
16/// Type-erased metadata carried alongside every dispatch.
17pub mod envelope;
18/// Unified framework error type.
19pub mod error;
20/// Async handler traits dispatched by the mediator.
21pub mod handler;
22/// Unique identifier newtypes for messages and correlations.
23pub mod ids;
24/// Middleware pipeline primitives.
25pub mod middleware;
26/// Marker trait for broadcast messages with fan-out semantics.
27pub mod notification;
28/// Marker trait for read-only messages asking for information.
29pub mod query;
30/// Handler registration metadata collected at link time by the
31/// `#[handler]` macro.
32pub mod registration;
33
34pub use command::Command;
35pub use context::HandlerContext;
36pub use envelope::MessageEnvelope;
37pub use error::{HexeractError, NotificationFailure};
38pub use handler::{CommandHandler, NotificationHandler, QueryHandler};
39pub use ids::{CorrelationId, MessageId};
40pub use middleware::{BoxOutput, DynMiddleware, Middleware, Next, Terminal};
41pub use notification::Notification;
42pub use query::Query;
43pub use registration::{HandlerKind, HandlerRegistration};