pub fn to_vec<T>( buf: Vec<u8>, value: &T) -> Result<Vec<u8>, Error<TryReserveError>> where T: Serialize,
Serializes a value to a writer.