diff --git a/src/cmd.rs b/src/cmd.rs index 5fc6481..e21e208 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -35,7 +35,8 @@ impl ActivityCmd { } pub fn fix_timestamps(&mut self) { - if let Some(timestamps) = self.args + if let Some(timestamps) = self + .args .as_mut() .and_then(|args| args.activity.as_mut()) .and_then(|activity| activity.timestamps.as_mut()) @@ -138,11 +139,11 @@ pub struct Activity { pub metadata: Option, } -#[skip_serializing_none] +#[skip_serializing_none] #[derive(Clone, Serialize, Deserialize, Debug, Default)] pub struct TimeoutValue(i64); -#[skip_serializing_none] +#[skip_serializing_none] #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Timestamps { #[serde(default)] @@ -151,7 +152,7 @@ pub struct Timestamps { pub end: Option, } -#[skip_serializing_none] +#[skip_serializing_none] #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Button { pub label: String, diff --git a/src/server/client_connector.rs b/src/server/client_connector.rs index 26b3e8a..4bec4ca 100644 --- a/src/server/client_connector.rs +++ b/src/server/client_connector.rs @@ -5,7 +5,10 @@ use std::{ use simple_websockets::{Event, EventHub, Message, Responder}; -use crate::{cmd::{ActivityCmd, ActivityPayload}, log}; +use crate::{ + cmd::{ActivityCmd, ActivityPayload}, + log, +}; use super::process::ProcessDetectedEvent; @@ -136,19 +139,22 @@ impl ClientConnector { let activity = args.activity.as_mut(); if let Some(activity) = activity { - activity.application_id= ipc_activity.application_id; + activity.application_id = ipc_activity.application_id; let payload = ActivityPayload { activity: Some(activity.clone()), pid: args.pid, socket_id: Some("0".to_string()), }; - + match serde_json::to_string(&payload) { Ok(payload) => { - log!("[Client Connector] Sending payload for IPC activity: {:?}", payload); + log!( + "[Client Connector] Sending payload for IPC activity: {:?}", + payload + ); ipc_clone.send_data(payload) - }, + } Err(err) => log!("[Client Connector] Error serializing IPC activity: {}", err), }; } else { @@ -291,19 +297,22 @@ impl ClientConnector { let activity = args.activity.as_mut(); if let Some(activity) = activity { - activity.application_id= ws_event.application_id; + activity.application_id = ws_event.application_id; let payload = ActivityPayload { activity: Some(activity.clone()), pid: args.pid, socket_id: Some("0".to_string()), }; - + match serde_json::to_string(&payload) { Ok(payload) => { - log!("[Client Connector] Sending payload for IPC activity: {:?}", payload); + log!( + "[Client Connector] Sending payload for IPC activity: {:?}", + payload + ); ws_clone.send_data(payload) - }, + } Err(err) => log!("[Client Connector] Error serializing IPC activity: {}", err), }; } else { diff --git a/src/server/process.rs b/src/server/process.rs index 680815d..933cfe6 100644 --- a/src/server/process.rs +++ b/src/server/process.rs @@ -1,5 +1,4 @@ use rayon::prelude::*; -use sysinfo::UpdateKind; use std::path::Path; use std::sync::atomic::AtomicBool; use std::sync::mpsc; @@ -7,6 +6,7 @@ use std::sync::Arc; use std::sync::Mutex; use std::time::Duration; use std::vec; +use sysinfo::UpdateKind; use sysinfo::{ProcessRefreshKind, RefreshKind, System}; use crate::log; @@ -207,8 +207,10 @@ impl ProcessServer { pub fn process_list() -> Vec { let mut processes = Vec::new(); - let sys = - System::new_with_specifics(RefreshKind::nothing().with_processes(ProcessRefreshKind::nothing().with_exe(UpdateKind::Always))); + let sys = System::new_with_specifics( + RefreshKind::nothing() + .with_processes(ProcessRefreshKind::nothing().with_exe(UpdateKind::Always)), + ); for proc in sys.processes() { processes.push(Exec {