1 2 3 4 5 6 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 }