aboutsummaryrefslogtreecommitdiff
path: root/src/common/json.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/json.rs')
-rw-r--r--src/common/json.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/json.rs b/src/common/json.rs
new file mode 100644
index 0000000..50bd788
--- /dev/null
+++ b/src/common/json.rs
@@ -0,0 +1,7 @@
+use serde::Serialize;
+
+pub fn serialize<S: Serialize>(s: S) -> Vec<u8> {
+ let mut buffer: Vec<u8> = Vec::new();
+ serde_json::to_writer(&mut buffer, &s).unwrap();
+ buffer
+}