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

Named serialization of inner values #217

Closed
spirali opened this issue Sep 6, 2019 · 2 comments

Comments

@spirali
Copy link

commented Sep 6, 2019

If there a posibility to serialize a structure into dictionary when it is inside an array?
It seems that to_vec_named works only for a top level structure.

#[derive(Debug, PartialEq, Serialize)]
struct Data {
    x: u32,
    y: u32
}
let data = Data {x: 123, y: 20}; 
rmps::encode::to_vec_named(&data).unwrap() // {'x': 123, 'y': 20}
rmps::encode::to_vec_named(&[data]).unwrap()); // [[123, 20]] 
@daboross

This comment has been minimized.

Copy link
Collaborator

commented Sep 9, 2019

What version of msgpack are you using?

I believe this is a known bug - fixed on master, but not yet released. See issue #205 and associated pull request #207.

@spirali

This comment has been minimized.

Copy link
Author

commented Sep 10, 2019

Thank you for information

@spirali spirali closed this Sep 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.