machine_check_gui/
shared.rs

1use machine_check_common::iir::property::IProperty;
2use serde::{Deserialize, Serialize};
3use snapshot::Snapshot;
4
5use crate::shared::snapshot::PropertyIndex;
6
7pub mod snapshot;
8
9/// Step settings.
10#[derive(Clone, Debug, Serialize, Deserialize)]
11pub struct StepSettings {
12    pub max_refinements: Option<u64>,
13    pub selected_property: IProperty,
14}
15
16/// Request for the backend to do something.
17#[derive(Clone, Debug, Serialize, Deserialize)]
18pub enum Request {
19    InitialContent,
20    GetContent,
21    Query,
22    Cancel,
23    Reset,
24    Step(StepSettings),
25    AddProperty(String),
26    RemoveProperty(PropertyIndex),
27}
28
29/// Backend status.
30#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
31pub enum BackendStatus {
32    Cancelling,
33    Waiting,
34    Running,
35}
36
37impl BackendStatus {
38    pub fn is_waiting(&self) -> bool {
39        matches!(self, BackendStatus::Waiting)
40    }
41}
42
43#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
44pub struct BackendSpaceInfo {
45    pub num_refinements: usize,
46    pub num_states: usize,
47    pub num_transitions: usize,
48}
49
50/// Information about the backend.
51#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
52pub struct BackendInfo {
53    pub status: BackendStatus,
54    pub space_info: BackendSpaceInfo,
55}
56
57/// Response from the backend to a request from the frontend.
58#[derive(Clone, Debug, Serialize, Deserialize)]
59pub struct Response {
60    pub info: BackendInfo,
61    pub snapshot: Option<Snapshot>,
62}