toml
toml copied to clipboard
the order of vectors order cause ValueAfterTable
use serde::Serialize;
use toml;
#[derive(Serialize)]
struct Outer {
v1: Vec<Inner>,
v2: Vec<Inner>,
}
#[derive(Serialize)]
struct Inner {}
fn main() {
let outer = Outer {
v1: vec![Inner {}],
v2: vec![],
};
println!("{}", toml::to_string(&outer).unwrap());
}
If I add option to them, it would be work.
#[derive(Serialize)]
struct Outer {
v1: Option<Vec<Inner>>,
v2: Option<Vec<Inner>>,
}
But it seems a little complicated. Are there other solutions for it?