Files
DSA/emulator/dsa_gui/src/state.rs
T

28 lines
870 B
Rust

use crate::ui::process_manager::ProcessSpawner;
use egui_tiles::TileId;
use std::fmt::Debug;
use std::path::PathBuf;
/// the action enum forms the core of the application's state.
/// - Actions are used as the main way that Tiles inside the application pass state updates back to the parent UI,
/// specifically when those state updates involve other files. for example, pressing "build" in the editor would emit
/// a SpawnProcess action, running some task which on completion emits a LoadBinary action on the result
#[derive(Debug)]
pub enum Action {
RequestCloseTab(TileId),
CloseTab(TileId),
Quit,
OpenFile(PathBuf),
LoadBinary(DataSource),
SaveFile(PathBuf, TileId),
RequestSaveAs(TileId),
ShowError(String),
SpawnProcess(ProcessSpawner),
}
#[derive(Debug, Clone)]
pub enum DataSource {
File(PathBuf),
Data(Vec<u8>),
}