Skip to main content

encode_into

Function encode_into 

Source
pub fn encode_into<T, W>(value: &T, writer: &mut W) -> Result<()>
where T: Serialize + ?Sized, W: Write,
Available on crate feature std only.
Expand description

Encode value and write the result into writer in a single call.

§Errors

§Examples

use pack_io::encode_into;

let mut buf: Vec<u8> = Vec::new();
encode_into(&(7_u64, "hello"), &mut buf).unwrap();
assert!(!buf.is_empty());