Make the tokio runtime optional
This commit is contained in:
8 files changed
+60
-28
No files matched your search
@@ -0,0 +1,37 @@
|
||||
//! Convert a serialized event to an event trigger
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub struct IpcMessage {
|
||||
method: String,
|
||||
params: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub enum IpcMethod<'a> {
|
||||
FileDialog,
|
||||
UserEvent,
|
||||
Query,
|
||||
BrowserOpen,
|
||||
Initialize,
|
||||
Other(&'a str),
|
||||
}
|
||||
|
||||
impl IpcMessage {
|
||||
pub(crate) fn method(&self) -> IpcMethod {
|
||||
match self.method.as_str() {
|
||||
// todo: this is a misspelling
|
||||
"file_diolog" => IpcMethod::FileDialog,
|
||||
"user_event" => IpcMethod::UserEvent,
|
||||
"query" => IpcMethod::Query,
|
||||
"browser_open" => IpcMethod::BrowserOpen,
|
||||
"initialize" => IpcMethod::Initialize,
|
||||
_ => IpcMethod::Other(&self.method),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn params(self) -> serde_json::Value {
|
||||
self.params
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user