1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-20 11:54:23 +02:00
ironbar/src/ipc/responses.rs

18 lines
413 B
Rust

use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Response {
Ok,
OkValue { value: String },
Err { message: Option<String> },
}
impl Response {
/// Creates a new `Response::Error`.
pub fn error(message: &str) -> Self {
Self::Err {
message: Some(message.to_string()),
}
}
}