What's the proper way to use serde in order to serialize primitive types?
For example the following code snippet throws an error:
extern crate serde; // 1.0.137
use serde::Serialize;
fn main ()
{
let test = true;
let serialized: Vec<u8> = vec![];
test.serialize(&mut serialized).unwrap();
}
And the error is:
error[E0277]: the trait bound
&mut Vec<u8>: Serializeris not satisfied
How can I serialize any primitive type into a byte vector/slice in Rust using serde?