- 
        Couldn't load subscription status. 
- Fork 22
Closed
Description
I use rmp-serde crate for serialisation. When I perform the difference serialisation I get the error
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: UnknownLength'
If a None value is passed to serialized_seq rmp-serde throws this error. See:
https://github.com/3Hren/msgpack-rust/blob/master/rmp-serde/src/encode.rs#L516
This is what serde-diff does:
https://github.com/amethyst/serde-diff/blob/master/src/lib.rs#L403
When serde-diff calls unwrap() this will throw an error. Though with bincode it won't panic.
use serde_diff::{Apply, Diff, SerdeDiff, FieldPathMode, Config};
use serde::{Serialize, Deserialize};
#[derive(SerdeDiff, Serialize, Deserialize, PartialEq, Debug)]
struct TestStruct {
    a: u32,
    b: f64,
}
fn main () {
    let old = TestStruct {
        a: 5,
        b: 2.,
    };
    let new = TestStruct {
        a: 8, // Differs from old.a, will be serialized
        b: 2.,
    };
    let diff = Config::new()
        .with_field_path_mode(FieldPathMode::Index)
        .serializable_diff(&old, &new);
    let msgpack_data = rmp_serde::to_vec(&diff).unwrap();
//    let bincode_data = bincode::serialize(&diff).unwrap();
}Metadata
Metadata
Assignees
Labels
No labels