```rust
extern crate bitsparrow_derive; extern crate bitsparrow;
use bitsparrow::*;
struct Foo {
bar: Vec
struct Bar(u16);
fn main() { let foo = Foo { bar: vec![Bar(10), Bar(1337)], baz: "Hello world".into(), derp: true, };
let expect = vec![
2, // Vec length
0x00,0x0A, // |-> 10
0x05,0x39, // `-> 1337
11, // String length
b'H',b'e',b'l',b'l',b'o',b' ',b'w',b'o',b'r',b'l',b'd', // `-> String data
1 // bool
];
let buffer = Encoder::encode(&foo);
let decoded: Foo = Decoder::decode(&buffer).unwrap();
assert_eq!(buffer, expect);
assert_eq!(decoded, foo);
} ```