Open Gigas002 opened 6 months ago
Code sample:
#[derive(Clone, Debug, Serialize, Deserialize)] pub struct Config { pub keybindings: Option<String>, #[serde(rename = "clipboard")] pub clipboard: Option<String>, #[serde(rename = "screenshot.filesystem")] pub filesystem: Option<String>, } impl Default for Config { fn default() -> Self { Config { keybindings: Some("hello".to_string()), clipboard: Some("toml".to_string()), filesystem: Some("serde".to_string()), } } } fn main() { let config = Config::default(); let serialized = toml::to_string_pretty(&config).unwrap(); let mut file = File::create("output.toml").unwrap(); file.write_all(serialized.as_bytes()).unwrap(); }
This code produces this output:
keybindings = "hello" clipboard = "toml" "screenshot.filesystem" = "serde"
Not sure if it's serde or toml crate's problem, though...
serde
toml
Code sample:
This code produces this output:
Not sure if it's
serde
ortoml
crate's problem, though...