pub fn to_bytes<T: Encode>(value: &T) -> Vec<u8> ⓘExpand description
Encodes value into a fresh Vec<u8>.
let bytes = cyclone_runtime::to_bytes(&Item { id: 42 });
assert_eq!(bytes, [0x2A, 0x00, 0x00, 0x00]);Use Writer directly when several values share one buffer, or when a
pre-sized buffer avoids reallocation.