pub fn to_vec<T>(to: &T) -> Result<Vec<u8>>where T: Serialize + ?Sized,
Write a value to a vector
when the data can not be written