Skip to main content

macp_core/
mode.rs

1//! The result a coordination mode hands back to the kernel.
2//!
3//! The `Mode` *trait* itself lives in `macp-modes` (behavior), but this enum
4//! (data) lives in core because [`crate::session::Session::apply_mode_response`]
5//! consumes it — keeping it here avoids a `macp-core -> macp-modes` cycle.
6
7/// The result of a Mode processing a message.
8/// The runtime applies this response to mutate session state.
9#[derive(Debug)]
10pub enum ModeResponse {
11    /// No state change needed.
12    NoOp,
13    /// Persist updated mode state.
14    PersistState(Vec<u8>),
15    /// Resolve the session with the given resolution data.
16    Resolve(Vec<u8>),
17    /// Persist mode state and resolve in one step.
18    PersistAndResolve { state: Vec<u8>, resolution: Vec<u8> },
19}