Function serde_bencoded::to_writer

source ·
pub fn to_writer<T: Serialize, W: Write>(value: &T, writer: W) -> SerResult<()>
Expand description

Serializes rust’s type to bencode using Write trait

§Examples

let mut buf = Vec::<u8>::new(); // `&mut Vec<u8>` implements `Write`
to_writer(&"abcd", &mut buf)?;
assert_eq!(&buf, b"4:abcd");