Skip to main content

to_writer

Function to_writer 

Source
pub fn to_writer<W: Write, T: Serialize + ?Sized>(
    writer: W,
    value: &T,
) -> Result<(), Error>
Expand description

Serializes a value to a writer.

The output of large values is written in pieces while they are serialized (see deser::io), the writer does not need to be buffered.

let mut out = Vec::new();
deser_msgpack::to_writer(&mut out, &vec![1u32, 2]).unwrap();
assert_eq!(out, [0x92, 0x01, 0x02]);