silak
1
Hello i am new to rust serde and i would like to ask if someone can show me playground example how to make efficient serialization for my enum.
use std::collections::HashMap;
pub enum Value {
Int(i32),
Float(f64),
Vector(Vec<u8>),
Bool(bool),
Map(HashMap<Value, Value>),
}
(Playground)
What's "inefficient" with #[derive(Serialize, Deserialize)]
?
silak
3
inefficient is that when i used to serialize after i found file much
longer than if i used rmpv crate
2023-01-30 18:19 GMT+01:00, Cerber-Ursi via The Rust Programming
Language Forum notifications@rust-lang.discoursemail.com:
To what format? JSON would likely be much larger then Bincode, for example.
silak
5
i used msg pack but i tried to derive serialize and deserialize for my
own enum and it was much longer file at the end compared to rmpv
2023-01-30 18:52 GMT+01:00, Cerber-Ursi via The Rust Programming
Language Forum notifications@rust-lang.discoursemail.com:
system
Closed
6
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.