From 3bc4c32a89e31da11466dc131528fc8e94f88663 Mon Sep 17 00:00:00 2001
From: theMackabu <theMackabu@gmail.com>
Date: Wed, 15 Nov 2023 18:24:44 -0800
Subject: [PATCH] release v0.1.1: add to_json

---
 Cargo.toml     | 8 ++++----
 src/lib.rs     | 8 ++++++++
 src/structs.rs | 2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 43fc476..e5a5731 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,15 +1,15 @@
 [package]
 name = "pawd"
-version = "0.1.0"
+version = "0.1.1"
 edition = "2021"
 license = "MIT"
 repository = "https://lab.themackabu.dev/crates/pawd"
 description = "Process analysis & watcher daemon"
 
 [dependencies]
+serde_json = "1.0.108"
 psutil = { version = "3.2.2", features = ["serde"] }
-serde = "1.0.192"
-serde_derive = "1.0.192"
+serde = { version = "1.0.192", features = ["derive"] }
 
 [dev-dependencies]
-assert_matches = "1.5.0"
\ No newline at end of file
+assert_matches = "1.5.0"
diff --git a/src/lib.rs b/src/lib.rs
index 08a4f2e..611890c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,6 +84,14 @@ impl Paw {
     }
 }
 
+impl PawResult {
+    pub fn to_json(&self) -> String { serde_json::to_string(self).unwrap() }
+}
+
+impl PawDone {
+    pub fn to_json(&self) -> String { serde_json::to_string(self).unwrap() }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
diff --git a/src/structs.rs b/src/structs.rs
index 3a67bc7..d838b27 100644
--- a/src/structs.rs
+++ b/src/structs.rs
@@ -1,5 +1,5 @@
 use psutil::process::MemoryInfo;
-use serde_derive::{Deserialize, Serialize};
+use serde::{Deserialize, Serialize};
 
 #[derive(Debug, Clone, Deserialize, Serialize)]
 pub struct PawResult {
-- 
GitLab