pub fn ser_to_vec_ordered<T>(value: &T, order: Order) -> Result<Vec<u8>>
Expand description
Serialize value
into byte vector
Example
#[derive(serde_derive::Serialize)]
struct Foo(u16, String);
let foo = Foo(1, "abc".to_string());
let buf = ser_to_vec_ordered(&foo, Order::Ascending).unwrap();
assert_eq!(&buf[2..5], b"abc");
assert_eq!(buf[5], 7); // last byte is string length (3) in varint encoding