trellis_runner/state/status.rs
1//! Module for abstractions about the state of a solver, and reasons why a solver may have
2//! terminated.
3
4use serde::{Deserialize, Serialize};
5
6/// The status of the solver
7#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize, Default)]
8pub enum Status {
9 /// A solver can either be [`NotTerminated`]
10 #[default]
11 NotTerminated,
12 /// Or the solver can be terminated for [`Cause`]
13 Terminated(Cause),
14}
15
16/// Causes for termination of a solver
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
18pub enum Cause {
19 /// The caller has manually terminated the process with ctrl-C
20 ControlC,
21 /// A parent thread had terminated the process using a [`tokio::CancellationToken`]
22 Parent,
23 /// The solver has converged to the requested tolerance
24 Converged,
25 /// The solver has exceeded the maximum allowable iterations
26 ExceededMaxIterations,
27}