diff options
author | David Orchard <if_coding@fastmail.com> | 2021-08-01 00:03:10 -0700 |
---|---|---|
committer | David Orchard <if_coding@fastmail.com> | 2021-08-15 10:31:58 -0700 |
commit | cc0530a7716779f954b1756905a9f4ceb7eb6d62 (patch) | |
tree | 311b2ca44a282bbc629a08123f53a855cba38c1c /examples | |
parent | 622efaca17256fb42dafc61c8df1f3037c1fb772 (diff) |
Move order preservation under a feature gate
Diffstat (limited to 'examples')
-rw-r--r-- | examples/async_source/main.rs | 5 | ||||
-rw-r--r-- | examples/glob/src/main.rs | 14 | ||||
-rw-r--r-- | examples/simple/src/main.rs | 6 | ||||
-rw-r--r-- | examples/watch/src/main.rs | 4 |
4 files changed, 14 insertions, 15 deletions
diff --git a/examples/async_source/main.rs b/examples/async_source/main.rs index 6c836a3..5134822 100644 --- a/examples/async_source/main.rs +++ b/examples/async_source/main.rs @@ -1,7 +1,6 @@ -use linked_hash_map::LinkedHashMap; use std::error::Error; -use config::{builder::AsyncState, AsyncSource, ConfigBuilder, ConfigError, FileFormat}; +use config::{builder::AsyncState, AsyncSource, ConfigBuilder, ConfigError, FileFormat, MapImpl}; use async_trait::async_trait; use futures::{select, FutureExt}; @@ -57,7 +56,7 @@ struct HttpSource { #[async_trait] impl AsyncSource for HttpSource { - async fn collect(&self) -> Result<LinkedHashMap<String, config::Value>, ConfigError> { + async fn collect(&self) -> Result<MapImpl<String, config::Value>, ConfigError> { reqwest::get(&self.uri) .await .map_err(|e| ConfigError::Foreign(Box::new(e)))? // error conversion is possible from custom AsyncSource impls diff --git a/examples/glob/src/main.rs b/examples/glob/src/main.rs index c85f86e..d429917 100644 --- a/examples/glob/src/main.rs +++ b/examples/glob/src/main.rs @@ -1,5 +1,5 @@ use std::path::Path; -use std::collections::LinkedHashMap; +use std::collections::MapImpl; use config::*; use glob::glob; @@ -14,9 +14,9 @@ fn main() { .merge(File::from(Path::new("conf/05-some.yml"))).unwrap() .merge(File::from(Path::new("conf/99-extra.json"))).unwrap(); - // Print out our settings (as a LinkedHashMap) + // Print out our settings (as a MapImpl) println!("\n{:?} \n\n-----------", - settings.try_into::<LinkedHashMap<String, String>>().unwrap()); + settings.try_into::<MapImpl<String, String>>().unwrap()); // Option 2 // -------- @@ -28,9 +28,9 @@ fn main() { File::from(Path::new("conf/99-extra.json"))]) .unwrap(); - // Print out our settings (as a LinkedHashMap) + // Print out our settings (as a MapImpl) println!("\n{:?} \n\n-----------", - settings.try_into::<LinkedHashMap<String, String>>().unwrap()); + settings.try_into::<MapImpl<String, String>>().unwrap()); // Option 3 // -------- @@ -43,7 +43,7 @@ fn main() { .collect::<Vec<_>>()) .unwrap(); - // Print out our settings (as a LinkedHashMap) + // Print out our settings (as a MapImpl) println!("\n{:?} \n\n-----------", - settings.try_into::<LinkedHashMap<String, String>>().unwrap()); + settings.try_into::<MapImpl<String, String>>().unwrap()); } diff --git a/examples/simple/src/main.rs b/examples/simple/src/main.rs index 698401a..5d4c3bc 100644 --- a/examples/simple/src/main.rs +++ b/examples/simple/src/main.rs @@ -1,4 +1,4 @@ -use std::collections::LinkedHashMap; +use std::collections::MapImpl; fn main() { let mut settings = config::Config::default(); @@ -9,7 +9,7 @@ fn main() { // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key .merge(config::Environment::with_prefix("APP")).unwrap(); - // Print out our settings (as a LinkedHashMap) + // Print out our settings (as a MapImpl) println!("{:?}", - settings.try_into::<LinkedHashMap<String, String>>().unwrap()); + settings.try_into::<MapImpl<String, String>>().unwrap()); } diff --git a/examples/watch/src/main.rs b/examples/watch/src/main.rs index 9e676ad..fed4ed0 100644 --- a/examples/watch/src/main.rs +++ b/examples/watch/src/main.rs @@ -1,5 +1,5 @@ use config::*; -use std::collections::LinkedHashMap; +use std::collections::MapImpl; use std::sync::RwLock; use notify::{RecommendedWatcher, DebouncedEvent, Watcher, RecursiveMode}; use std::sync::mpsc::channel; @@ -20,7 +20,7 @@ fn show() { .read() .unwrap() .clone() - .try_into::<LinkedHashMap<String, String>>() + .try_into::<MapImpl<String, String>>() .unwrap()); } |