mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-21 02:09:25 +08:00
63 lines
1.4 KiB
Rust
63 lines
1.4 KiB
Rust
use std::sync::mpsc::SyncSender;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, clap::ValueEnum)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub enum DeveloperHudState {
|
|
Reset,
|
|
Recording,
|
|
Transcribing,
|
|
Processing,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, clap::ValueEnum)]
|
|
#[serde(rename_all = "kebab-case")]
|
|
pub enum DeveloperPane {
|
|
Settings,
|
|
#[serde(alias = "replacements")]
|
|
#[value(alias = "replacements")]
|
|
Modes,
|
|
History,
|
|
HudLab,
|
|
Meetings,
|
|
Fun,
|
|
Activity,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
#[serde(tag = "command", rename_all = "kebab-case")]
|
|
pub enum DeveloperCommand {
|
|
Status,
|
|
Hud { state: DeveloperHudState },
|
|
ShowPane { pane: DeveloperPane },
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
#[serde(tag = "status", rename_all = "kebab-case")]
|
|
pub enum DeveloperReply {
|
|
Ok,
|
|
State {
|
|
window_open: bool,
|
|
pane: Option<DeveloperPane>,
|
|
},
|
|
Error {
|
|
code: String,
|
|
message: String,
|
|
},
|
|
}
|
|
|
|
pub struct DeveloperCall {
|
|
pub command: DeveloperCommand,
|
|
pub reply: SyncSender<DeveloperReply>,
|
|
}
|
|
|
|
impl DeveloperReply {
|
|
pub fn error(code: impl Into<String>, message: impl Into<String>) -> Self {
|
|
Self::Error {
|
|
code: code.into(),
|
|
message: message.into(),
|
|
}
|
|
}
|
|
}
|