#[derive(Debug, Clone)]
#[derive(serde::Serialize, serde::Deserialize)]
struct Foo2 {
a: u32,
b: u32,
}
#[derive(Debug, Clone)]
#[derive(serde::Serialize, serde::Deserialize)]
struct Foo3 {
a: u32,
b: u32,
c: Option<u64>,
}
#[ignore]
#[test]
fn test_add_field() -> anyhow::Result<()> {
let f = Foo2 { a: 1, b: 2 };
let v = bincode::serde::encode_to_vec(f, bincode_config()).unwrap();
let (foo3, _): (Foo3, _) = bincode::serde::decode_from_slice(&v[..], bincode_config())?;
println!("{:?}", foo3);
Ok(())
}
pub fn bincode_config() -> impl bincode::config::Config {
bincode::config::standard().with_big_endian().with_variable_int_encoding()
}