Function postcard::to_extend

source ·
pub fn to_extend<'a, T, W>(value: &'a T, writer: W) -> Result<W>
where T: Serialize + ?Sized, W: Extend<u8>,
Expand description

Serialize a T to a core::iter::Extend,

§Example

use postcard::to_extend;
let mut vec = Vec::new();

let ser = to_extend(&true, vec).unwrap();
let vec = to_extend("Hi!", ser).unwrap();
assert_eq!(&vec[0..5], &[0x01, 0x03, b'H', b'i', b'!']);