diff options
Diffstat (limited to 'src/source.rs')
-rw-r--r-- | src/source.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/source.rs b/src/source.rs index 831e4c4..7d257d0 100644 --- a/src/source.rs +++ b/src/source.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use linked_hash_map::LinkedHashMap; use std::fmt::Debug; use std::str::FromStr; @@ -13,8 +13,8 @@ pub trait Source: Debug { fn clone_into_box(&self) -> Box<dyn Source + Send + Sync>; /// Collect all configuration properties available from this source and return - /// a HashMap. - fn collect(&self) -> Result<HashMap<String, Value>>; + /// a LinkedHashMap. + fn collect(&self) -> Result<LinkedHashMap<String, Value>>; /// Collects all configuration properties to a provided cache. fn collect_to(&self, cache: &mut Value) -> Result<()> { @@ -55,8 +55,8 @@ pub trait AsyncSource: Debug + Sync { // Sync is supertrait due to https://docs.rs/async-trait/0.1.50/async_trait/index.html#dyn-traits /// Collects all configuration properties available from this source and return - /// a HashMap as an async operations. - async fn collect(&self) -> Result<HashMap<String, Value>>; + /// a LinkedHashMap as an async operations. + async fn collect(&self) -> Result<LinkedHashMap<String, Value>>; /// Collects all configuration properties to a provided cache. async fn collect_to(&self, cache: &mut Value) -> Result<()> { @@ -86,8 +86,8 @@ impl Source for Vec<Box<dyn Source + Send + Sync>> { Box::new((*self).clone()) } - fn collect(&self) -> Result<HashMap<String, Value>> { - let mut cache: Value = HashMap::<String, Value>::new().into(); + fn collect(&self) -> Result<LinkedHashMap<String, Value>> { + let mut cache: Value = LinkedHashMap::<String, Value>::new().into(); for source in self { source.collect_to(&mut cache)?; @@ -106,8 +106,8 @@ impl Source for [Box<dyn Source + Send + Sync>] { Box::new(self.to_owned()) } - fn collect(&self) -> Result<HashMap<String, Value>> { - let mut cache: Value = HashMap::<String, Value>::new().into(); + fn collect(&self) -> Result<LinkedHashMap<String, Value>> { + let mut cache: Value = LinkedHashMap::<String, Value>::new().into(); for source in self { source.collect_to(&mut cache)?; @@ -131,8 +131,8 @@ where Box::new((*self).clone()) } - fn collect(&self) -> Result<HashMap<String, Value>> { - let mut cache: Value = HashMap::<String, Value>::new().into(); + fn collect(&self) -> Result<LinkedHashMap<String, Value>> { + let mut cache: Value = LinkedHashMap::<String, Value>::new().into(); for source in self { source.collect_to(&mut cache)?; |