Skip to main content

ironstate/
lib.rs

1#![doc(
2    html_logo_url = "https://raw.githubusercontent.com/kassian-dev/ironstate/main/assets/logo.png",
3    html_favicon_url = "https://raw.githubusercontent.com/kassian-dev/ironstate/main/assets/favicon-32.png"
4)]
5#![doc = include_str!("../README.md")]
6#![forbid(unsafe_code)]
7#![warn(missing_docs)]
8
9// Lets the derive macros emit `::ironstate::…` paths that also resolve inside
10// this crate's own tests and doctests.
11extern crate self as ironstate;
12
13mod analysis;
14mod error;
15mod invariant;
16mod kind;
17mod listener;
18mod machine;
19#[macro_use]
20mod macros;
21mod metadata;
22mod migrate;
23#[cfg(feature = "proptest")]
24mod testing;
25
26pub use error::{RestoreError, TransitionError};
27pub use invariant::{Invariant, Invariants};
28pub use kind::Kind;
29pub use listener::TransitionRecord;
30pub use machine::{EventKind, Machine, StateMachine, TransitionRules};
31pub use metadata::MachineMetadata;
32pub use migrate::{MigrateFrom, Versioned};
33
34#[cfg(feature = "derive")]
35pub use ironstate_derive::{Event, StateMachine};
36
37/// Graph-analysis report types produced by [`analyze!`].
38pub mod analysis_report {
39    pub use crate::analysis::{Claim, Confidence, Report, analyze};
40}
41
42/// Runtime support invoked by the [`test!`] macro; not part of the stable surface.
43#[cfg(feature = "proptest")]
44#[doc(hidden)]
45pub mod testing_support {
46    pub use crate::testing::*;
47}
48
49/// Internal runtime invoked by generated derive code; not a stable surface.
50#[doc(hidden)]
51#[cfg(feature = "restore")]
52pub mod __rt {
53    pub use crate::migrate::rt::*;
54}
55
56/// The common imports for defining and running a machine.
57pub mod prelude {
58    // `StateMachine` names both the trait and (under `derive`) the derive macro —
59    // they live in different namespaces, so a single import brings whichever exist.
60    #[cfg(feature = "derive")]
61    pub use crate::Event;
62    pub use crate::{
63        EventKind, Invariant, Invariants, Kind, Machine, MigrateFrom, RestoreError, StateMachine,
64        TransitionError, TransitionRules, Versioned,
65    };
66}