You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
confy requires serde for serialization and deserialization and the documentaion is not clear about this. Also confy will fail in file is missing my_app so Default trait was also added.
Add confy and serde to your cargo.toml
confy = "0.4.0"
serde = { version = "1.0", features = ["derive"] }
Add Default trait to generate a file with default values if missing.
use serde::{Serialize,Deserialize};#[derive(Default,Debug,Serialize,Deserialize)]structMyConfig{name:String,comfy:bool,foo:i64,}fnmain() -> Result<(), io::Error>{let cfg:MyConfig = confy::load("my_app")?;println!("{:#?}", cfg);Ok(())}
The text was updated successfully, but these errors were encountered:
confy requires serde for serialization and deserialization and the documentaion is not clear about this. Also confy will fail in file is missing
my_app
so Default trait was also added.Add confy and serde to your cargo.toml
Add Default trait to generate a file with default values if missing.
The text was updated successfully, but these errors were encountered: