summaryrefslogtreecommitdiffstats
path: root/examples/basic
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-03-08 11:09:37 -0800
committerRyan Leckey <leckey.ryan@gmail.com>2017-03-08 11:09:37 -0800
commit2dc6a74b84825f65142c1fa7d3e67cd4f35ee3cb (patch)
tree23b21f732efbb215498db6debf6dbaee3af7e94f /examples/basic
parentc9ee1568fe212e4c352ec1afc52db44b34348fcd (diff)
Initial work on deep serde integration
Diffstat (limited to 'examples/basic')
-rw-r--r--examples/basic/Cargo.toml3
-rw-r--r--examples/basic/src/main.rs50
2 files changed, 28 insertions, 25 deletions
diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml
index 7ede162..25c3f4d 100644
--- a/examples/basic/Cargo.toml
+++ b/examples/basic/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "basic"
version = "0.1.0"
+workspace = "../../"
[dependencies]
-config = { path = "../..", default-features = false }
+config = { path = "../../lib" }
diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs
index 2f947d8..49059ef 100644
--- a/examples/basic/src/main.rs
+++ b/examples/basic/src/main.rs
@@ -1,33 +1,35 @@
extern crate config;
+use config::*;
+
fn main() {
- let mut c = config::Config::new();
+ let mut c = Config::default();
- // 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();
+ // // 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"));
+ // // 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"));
+ // // 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());
+ // // 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"));
+ // // Attempting to get a value that does not exist will return None
+ // println!("not-found : {:?}", c.get("not-found"));
}