Collapse objects into single shared object

This commit is contained in:
Jonathan Kelley committed 2024-01-04 20:17:38 -08:00
1 parent 2e9737ef57
commit 4adc912189
7 files changed
+203 -218

No files matched your search

+5 -3
View File
@@ -1,13 +1,15 @@
//! Convert a serialized event to an event trigger
use serde::{Deserialize, Serialize};
/// A message struct that manages the communication between the webview and the eventloop code
///
/// This needs to be serializable across the JS boundary, so the method names and structs are sensitive.
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct IpcMessage {
method: String,
params: serde_json::Value,
}
/// A set of known messages that we need to respond to
#[derive(Deserialize, Serialize, Debug, Clone)]
pub enum IpcMethod<'a> {
FileDialog,
@@ -21,7 +23,7 @@ pub enum IpcMethod<'a> {
impl IpcMessage {
pub(crate) fn method(&self) -> IpcMethod {
match self.method.as_str() {
// todo: this is a misspelling
// todo: this is a misspelling, needs to be fixed
"file_diolog" => IpcMethod::FileDialog,
"user_event" => IpcMethod::UserEvent,
"query" => IpcMethod::Query,