diff options
Diffstat (limited to 'examples/file-toml')
-rw-r--r-- | examples/file-toml/Cargo.toml | 9 | ||||
-rw-r--r-- | examples/file-toml/Settings.toml | 4 | ||||
-rw-r--r-- | examples/file-toml/src/main.rs | 22 |
3 files changed, 0 insertions, 35 deletions
diff --git a/examples/file-toml/Cargo.toml b/examples/file-toml/Cargo.toml deleted file mode 100644 index 0501895..0000000 --- a/examples/file-toml/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "file-toml" -version = "0.1.0" -workspace = "../../" - -[dependencies] -config = { path = "../../lib", features = ["toml"] } -serde = "^0.9" -serde_derive = "^0.9" diff --git a/examples/file-toml/Settings.toml b/examples/file-toml/Settings.toml deleted file mode 100644 index 21fa1e3..0000000 --- a/examples/file-toml/Settings.toml +++ /dev/null @@ -1,4 +0,0 @@ -debug = true -pi = 3.14159 -weight = 150 -location = { x = 10, y = 30 } diff --git a/examples/file-toml/src/main.rs b/examples/file-toml/src/main.rs deleted file mode 100644 index ddca412..0000000 --- a/examples/file-toml/src/main.rs +++ /dev/null @@ -1,22 +0,0 @@ -extern crate config; - -#[macro_use] -extern crate serde_derive; - -#[derive(Debug, Deserialize)] -struct Point { x: i64, y: i64 } - -fn main() { - let mut c = config::Config::default(); - - // Read configuration from "Settings.toml" - c.merge(config::File::new("Settings", config::FileFormat::Toml)).unwrap(); - - // Simple key access to values - println!("debug = {}", c.get::<bool>("debug").unwrap()); - println!("pi = {}", c.get::<f64>("pi").unwrap()); - println!("weight = {}", c.get::<i64>("weight").unwrap()); - println!("location = {:?}", c.get::<Point>("location").unwrap()); - // println!("location.x = {}", c.get::<Point>("location.x").unwrap()); - // println!("location.y = {}", c.get::<Point>("location.y").unwrap()); -} |