libpetri_event/lib.rs
1//! # libpetri-event — Execution Event System
2//!
3//! Records observable events during Petri net execution for debugging,
4//! testing, and live inspection.
5//!
6//! ## Event Store
7//!
8//! The [`EventStore`](event_store::EventStore) trait defines event recording.
9//! Two implementations are provided:
10//!
11//! - [`NoopEventStore`](event_store::NoopEventStore) — Production use. All
12//! methods are no-ops, fully eliminated at compile time.
13//! - [`InMemoryEventStore`](event_store::InMemoryEventStore) — Testing and
14//! debugging. Stores all events in a `Vec<NetEvent>`.
15//!
16//! ## Zero-Cost Design
17//!
18//! The `ENABLED` associated constant on `EventStore` enables compile-time
19//! elimination. The executor guards every `append()` call with
20//! `if E::ENABLED { ... }` — when `E = NoopEventStore`, the compiler
21//! removes the entire branch (including argument construction) as dead code.
22//!
23//! ## Event Types
24//!
25//! [`NetEvent`](net_event::NetEvent) is a 13-variant enum:
26//!
27//! | Category | Events |
28//! |----------|--------|
29//! | **Lifecycle** | `ExecutionStarted`, `ExecutionCompleted` |
30//! | **Transitions** | `TransitionEnabled`, `TransitionStarted`, `TransitionCompleted` |
31//! | **Timing** | `TransitionClockRestarted`, `TransitionTimedOut`, `ActionTimedOut` |
32//! | **Failures** | `TransitionFailed` |
33//! | **Tokens** | `TokenAdded`, `TokenRemoved` |
34//! | **Diagnostics** | `LogMessage`, `MarkingSnapshot` |
35
36pub mod event_store;
37pub mod net_event;