diff options
author | evuez <julien@mulga.net> | 2024-04-03 22:43:16 +0200 |
---|---|---|
committer | evuez <julien@mulga.net> | 2024-04-03 22:43:16 +0200 |
commit | 43e1a12b5bce11b4a28a53acca243e35c2be6d3e (patch) | |
tree | 07d64823718bfee063ab7b3d5721ac1e950ae17c /src/common/json.rs | |
download | carton-43e1a12b5bce11b4a28a53acca243e35c2be6d3e.tar.gz |
Initial commit
Diffstat (limited to 'src/common/json.rs')
-rw-r--r-- | src/common/json.rs | 7 |
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 +} |