diff options
author | Thayne McCombs <astrothayne@gmail.com> | 2017-02-03 22:02:48 -0700 |
---|---|---|
committer | Thayne McCombs <astrothayne@gmail.com> | 2017-02-03 22:02:48 -0700 |
commit | f82ca02c15b675ba889143aa7f7cd3c69e3f1810 (patch) | |
tree | f5448f1473899936eb6ed62b4e7fa34c34d62a69 /examples | |
parent | 115fe07e2c11aa72e91a5ce9b028ed1c1ff7d806 (diff) |
Add support for YAML
Diffstat (limited to 'examples')
-rw-r--r-- | examples/file-yaml/Cargo.toml | 6 | ||||
-rw-r--r-- | examples/file-yaml/Settings.yaml | 3 | ||||
-rw-r--r-- | examples/file-yaml/src/main.rs | 10 |
3 files changed, 19 insertions, 0 deletions
diff --git a/examples/file-yaml/Cargo.toml b/examples/file-yaml/Cargo.toml new file mode 100644 index 0000000..70176b1 --- /dev/null +++ b/examples/file-yaml/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "file-yaml" +version = "0.1.0" + +[dependencies] +config = { path = "../..", default-features = false, features = ["yaml"] } diff --git a/examples/file-yaml/Settings.yaml b/examples/file-yaml/Settings.yaml new file mode 100644 index 0000000..d92f6ad --- /dev/null +++ b/examples/file-yaml/Settings.yaml @@ -0,0 +1,3 @@ +debug: false +pi: 3.14159 +weight: 150 diff --git a/examples/file-yaml/src/main.rs b/examples/file-yaml/src/main.rs new file mode 100644 index 0000000..cd3286f --- /dev/null +++ b/examples/file-yaml/src/main.rs @@ -0,0 +1,10 @@ +extern crate config; + +fn main() { + // Read configuration from "Settings.yaml" + config::merge(config::File::new("Settings", config::FileFormat::Yaml)).unwrap(); + + println!("debug = {:?}", config::get("debug")); + println!("pi = {:?}", config::get("pi")); + println!("weight = {:?}", config::get("weight")); +} |