3Hren / msgpack-rust

MessagePack implementation for Rust / msgpack.org[Rust]
MIT License
1.17k stars 130 forks source link

Wrong integer types when deserializing zvariant Values? #339

Closed Amulet9 closed 1 year ago

Amulet9 commented 1 year ago

Hello, I was recently trying to use msgpack to serialize data, and there seems to be an issue when deserializing zvariant values, the integer types are not correct. For example:

use zvariant::OwnedValue;

fn main() {
    let foo = Foo { data: 9001.into() };
    let serialized = rmp_serde::to_vec(&foo).expect("Failed to serialize");
    let deserialized: Foo = rmp_serde::from_slice(&serialized).expect("Failed to deserialize");
    assert_eq!(foo, deserialized)
}

#[derive(serde::Serialize, Debug, PartialEq, serde::Deserialize)]
struct Foo {
    data: OwnedValue,
}

with

[dependencies]
rmp-serde = "1.1.2"
serde = { version = "1.0.189", features = ["derive"] }
zvariant = "3.15.0"

fails to run successfully, because image

I am not exactly sure why this is happening, So i was wondering if someone could clue me on this.