summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRyan Leckey <ryan@launchbadge.com>2017-06-01 23:22:04 -0700
committerRyan Leckey <ryan@launchbadge.com>2017-06-01 23:22:04 -0700
commitbfc44c331a77d8c341c076e72df5ed0b56fbd422 (patch)
treec757723957be6b880d1e0d8d26ae2b1c9c606ed2 /examples
parent4357840e95f3646494ddeea4aae12425dfab2db8 (diff)
Move things around and get some tests in place
Diffstat (limited to 'examples')
-rw-r--r--examples/basic/Cargo.toml7
-rw-r--r--examples/basic/src/main.rs35
-rw-r--r--examples/file-json/Cargo.toml7
-rw-r--r--examples/file-json/Settings.json5
-rw-r--r--examples/file-json/src/main.rs12
-rw-r--r--examples/file-toml/Cargo.toml9
-rw-r--r--examples/file-toml/Settings.toml4
-rw-r--r--examples/file-toml/src/main.rs22
-rw-r--r--examples/file-yaml/Cargo.toml7
-rw-r--r--examples/file-yaml/Settings.yaml3
-rw-r--r--examples/file-yaml/src/main.rs12
11 files changed, 0 insertions, 123 deletions
diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml
deleted file mode 100644
index 25c3f4d..0000000
--- a/examples/basic/Cargo.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-[package]
-name = "basic"
-version = "0.1.0"
-workspace = "../../"
-
-[dependencies]
-config = { path = "../../lib" }
diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs
deleted file mode 100644
index 49059ef..0000000
--- a/examples/basic/src/main.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-extern crate config;
-
-use config::*;
-
-fn main() {
- 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();
-
- // // 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"));
-}
diff --git a/examples/file-json/Cargo.toml b/examples/file-json/Cargo.toml
deleted file mode 100644
index 1e8765e..0000000
--- a/examples/file-json/Cargo.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-[package]
-name = "file-json"
-version = "0.1.0"
-workspace = "../../"
-
-[dependencies]
-config = { path = "../../lib", default-features = false, features = ["json"] }
diff --git a/examples/file-json/Settings.json b/examples/file-json/Settings.json
deleted file mode 100644
index 72b28e6..0000000
--- a/examples/file-json/Settings.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "debug": false,
- "pi": 3.14159,
- "weight": 150
-}
diff --git a/examples/file-json/src/main.rs b/examples/file-json/src/main.rs
deleted file mode 100644
index e4ff809..0000000
--- a/examples/file-json/src/main.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-extern crate config;
-
-fn main() {
- let mut c = config::Config::new();
-
- // Read configuration from "Settings.json"
- c.merge(config::File::new("Settings", config::FileFormat::Json)).unwrap();
-
- println!("debug = {:?}", c.get("debug"));
- println!("pi = {:?}", c.get("pi"));
- println!("weight = {:?}", c.get("weight"));
-}
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());
-}
diff --git a/examples/file-yaml/Cargo.toml b/examples/file-yaml/Cargo.toml
deleted file mode 100644
index 4570078..0000000
--- a/examples/file-yaml/Cargo.toml
+++ /dev/null
@@ -1,7 +0,0 @@
-[package]
-name = "file-yaml"
-version = "0.1.0"
-workspace = "../../"
-
-[dependencies]
-config = { path = "../../lib", default-features = false, features = ["yaml"] }
diff --git a/examples/file-yaml/Settings.yaml b/examples/file-yaml/Settings.yaml
deleted file mode 100644
index d92f6ad..0000000
--- a/examples/file-yaml/Settings.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-debug: false
-pi: 3.14159
-weight: 150
diff --git a/examples/file-yaml/src/main.rs b/examples/file-yaml/src/main.rs
deleted file mode 100644
index 6d72976..0000000
--- a/examples/file-yaml/src/main.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-extern crate config;
-
-fn main() {
- let mut c = config::Config::new();
-
- // Read configuration from "Settings.yaml"
- c.merge(config::File::new("Settings", config::FileFormat::Yaml)).unwrap();
-
- println!("debug = {:?}", c.get("debug"));
- println!("pi = {:?}", c.get("pi"));
- println!("weight = {:?}", c.get("weight"));
-}