Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serde::to_vec(rmpv::Value) works unexpected #320

Open
godzie44 opened this issue Oct 25, 2022 · 0 comments
Open

serde::to_vec(rmpv::Value) works unexpected #320

godzie44 opened this issue Oct 25, 2022 · 0 comments

Comments

@godzie44
Copy link

Hi!
Looks like rmp_serde::to_vec works not properly for rmpv::Value with map inside it. I'm expected that result is encoded message pack vector, but result is a map. For example:

#[test]
fn serialize_value_as_map() {
    let value = rmpv::Value::Map(vec![
        (rmpv::Value::from("a"), rmpv::Value::from(1)),
        (rmpv::Value::from("b"), rmpv::Value::from(2)),
    ]);
    let encoded = rmp_serde::to_vec(&value).unwrap();

    assert_eq!(vec![130, 161, 97, 1, 161, 98, 2], encoded);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant