pub fn to_vec<T: Serialize + ?Sized>(doc: &T) -> Result<Vec<u8>, Error>
Serialize a document into a buffer of bytes.