pub fn encode_into<T, W>(value: &T, writer: &mut W) -> Result<()>Available on crate feature
std only.Expand description
Encode value and write the result into writer in a single call.
§Errors
- Propagates any
crate::SerialErrorfrom the type’sSerialize. - Maps any
std::io::Errorfrom the writer intoSerialError::Io.
§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());