chore: remove unnecessary parse method

This commit is contained in:
Jonathan Kelley 2022-12-30 01:54:12 -05:00
parent 531f7c6d3f
commit d160a5c8ff
2 changed files with 1 additions and 12 deletions

View File

@ -17,13 +17,3 @@ impl IpcMessage {
self.params
}
}
pub(crate) fn parse_ipc_message(payload: &str) -> Option<IpcMessage> {
match serde_json::from_str(payload) {
Ok(message) => Some(message),
Err(e) => {
log::error!("could not parse IPC message, error: {}", e);
None
}
}
}

View File

@ -1,6 +1,5 @@
use std::rc::Rc;
use crate::events::parse_ipc_message;
use crate::protocol;
use crate::{desktop_context::UserWindowEvent, Config};
use tao::event_loop::{EventLoopProxy, EventLoopWindowTarget};
@ -41,7 +40,7 @@ pub fn build(
.unwrap()
.with_ipc_handler(move |_window: &Window, payload: String| {
// defer the event to the main thread
if let Some(message) = parse_ipc_message(&payload) {
if let Ok(message) = serde_json::from_str(&payload) {
_ = proxy.send_event(UserWindowEvent::Ipc(message));
}
})