1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Mindset: A pure functional state machine library
//!
//! Mindset is built on Stillwater's "pure core, imperative shell" philosophy.
//! The core state machine logic is composed of pure functions with no side effects,
//! while effects are isolated in Effect monads using Stillwater 0.11.0.
//!
//! # Core Concepts
//!
//! - **State**: Type-safe state representation via the `State` trait
//! - **Guards**: Pure predicate functions that control transitions
//! - **History**: Immutable tracking of state transitions over time
//! - **Effects**: Effectful state transitions using Stillwater's zero-cost effect system
//!
//! # Example
//!
//! ```rust
//! use mindset::core::{State, StateHistory, StateTransition};
//! use mindset::effects::{StateMachine, Transition, TransitionResult};
//! use serde::{Deserialize, Serialize};
//! use chrono::Utc;
//! use stillwater::prelude::*;
//! use std::sync::Arc;
//!
//! #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
//! enum WorkflowState {
//! Initial,
//! Processing,
//! Complete,
//! }
//!
//! impl State for WorkflowState {
//! fn name(&self) -> &str {
//! match self {
//! Self::Initial => "Initial",
//! Self::Processing => "Processing",
//! Self::Complete => "Complete",
//! }
//! }
//!
//! fn is_final(&self) -> bool {
//! matches!(self, Self::Complete)
//! }
//! }
//!
//! // Create a state machine with effectful transitions
//! let mut machine: StateMachine<WorkflowState, ()> = StateMachine::new(WorkflowState::Initial);
//!
//! // Add a transition with an action factory
//! machine.add_transition(Transition {
//! from: WorkflowState::Initial,
//! to: WorkflowState::Processing,
//! guard: None,
//! action: Arc::new(|| pure(TransitionResult::Success(WorkflowState::Processing)).boxed()),
//! });
//! ```
// Re-export commonly used types
pub use ;
pub use ;
pub use ;
pub use ;