sequent_repl/lib.rs
1//! An adapter for using Sequent with Revolver.
2
3pub mod commands;
4
5use sequent::{Decoder, Simulation};
6use revolver::terminal::{AccessTerminalError, Terminal};
7
8/// Specification of a minimal application context for simulations.
9pub trait Context {
10 /// The state type.
11 type State;
12
13 /// A mutable reference to the simulation.
14 fn sim(&mut self) -> &mut Simulation<Self::State>;
15
16 /// Prints the current state to the given terminal interface.
17 ///
18 /// # Errors
19 /// [`AccessTerminalError`] if an error occurs while writing to the terminal.
20 fn print_state(&self, terminal: &mut impl Terminal) -> Result<(), AccessTerminalError>;
21
22 /// A reference to a decoder for parsing events.
23 fn decoder(&self) -> &Decoder<Self::State>;
24}