pub fn to_stdvec<T>(value: &T) -> Result<Vec<u8>>
Expand description
Serialize a T
to a std::vec::Vec<u8>
.
§Example
use postcard::to_stdvec;
let ser: Vec<u8> = to_stdvec(&true).unwrap();
assert_eq!(ser.as_slice(), &[0x01]);
let ser: Vec<u8> = to_stdvec("Hi!").unwrap();
assert_eq!(ser.as_slice(), &[0x03, b'H', b'i', b'!']);