diff options
Diffstat (limited to 'examples/file-toml')
-rw-r--r-- | examples/file-toml/Cargo.toml | 6 | ||||
-rw-r--r-- | examples/file-toml/src/main.rs | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/examples/file-toml/Cargo.toml b/examples/file-toml/Cargo.toml new file mode 100644 index 0000000..6f45799 --- /dev/null +++ b/examples/file-toml/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "file-toml" +version = "0.1.0" + +[dependencies] +config = { path = "../.." } diff --git a/examples/file-toml/src/main.rs b/examples/file-toml/src/main.rs new file mode 100644 index 0000000..03ce61a --- /dev/null +++ b/examples/file-toml/src/main.rs @@ -0,0 +1,9 @@ +extern crate config; + +fn main() { + // Read configuration from $(cwd)/Cargo.toml + config::merge(config::File::new("Cargo", config::FileFormat::Toml)).unwrap(); + + println!("package.name = {:?}", config::get_str("package.name")); + println!("package.version = {:?}", config::get_str("package.version")); +} |