diff options
author | Ryan Leckey <ryan@launchbadge.com> | 2017-06-13 18:55:40 -0700 |
---|---|---|
committer | Ryan Leckey <ryan@launchbadge.com> | 2017-06-13 18:55:40 -0700 |
commit | 47ad966e064f842056e7c1b7abe8ef64d127f5be (patch) | |
tree | 4dd4e14168383dd818fe6add8ed0a5f4900d85b6 /examples/basic/src/main.rs | |
parent | 1266d110ba31a9d0f9f4908a5a30291899ffc8fc (diff) | |
parent | 312f32905f518fa59e1daf3fc8224dadf584b484 (diff) |
Merge branch 'serde'
Diffstat (limited to 'examples/basic/src/main.rs')
-rw-r--r-- | examples/basic/src/main.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs deleted file mode 100644 index 2f947d8..0000000 --- a/examples/basic/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -extern crate config; - -fn main() { - let mut c = config::Config::new(); - - // Set defaults for `window.width` and `window.height` - c.set_default("window.title", "Basic").unwrap(); - c.set_default("window.width", 640).unwrap(); - c.set_default("window.height", 480).unwrap(); - c.set_default("debug", true).unwrap(); - - // Note that you can retrieve the stored values as any type as long - // as there exists a reasonable conversion - println!("window.title : {:?}", c.get_str("window.title")); - println!("window.width : {:?}", c.get_str("window.width")); - println!("window.width : {:?}", c.get_int("window.width")); - println!("debug : {:?}", c.get_bool("debug")); - println!("debug : {:?}", c.get_str("debug")); - println!("debug : {:?}", c.get_int("debug")); - - // Attempting to get a value as a type that cannot be reasonably - // converted to will return None - println!("window.title : {:?}", c.get_bool("window.title")); - - // Instead of using a get_* function you can get the variant - // directly - println!("debug : {:?}", c.get("debug")); - println!("debug : {:?}", - c.get("debug").unwrap().into_int()); - - // Attempting to get a value that does not exist will return None - println!("not-found : {:?}", c.get("not-found")); -} |