Created
May 28, 2018 22:11
-
-
Save strangeglyph/e92fb18eb0d4d85ddb548526b298ce8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, Serialize, Deserialize)] | |
struct Thing { | |
value: String, | |
} | |
pub fn do_the_thing() { | |
let mut cfg = cfg::Config::default(); | |
cfg.set("value", "didn't do the thing").unwrap(); | |
cfg.merge(cfg::File::with_name("./thing.yml")).unwrap(); | |
// --- | |
// value: did the thing | |
let thing: Thing = cfg.try_into().unwrap(); | |
println!("{}", thing.value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment