diff options
author | David Orchard <if_coding@fastmail.com> | 2021-07-28 22:52:15 -0700 |
---|---|---|
committer | David Orchard <if_coding@fastmail.com> | 2021-08-15 10:31:18 -0700 |
commit | fc8cf0ed674cbb495df1baff34d4b832ca5fad3c (patch) | |
tree | a83c82ff11399ebd2da8d7ae58da31b7f295998c /src/source.rs | |
parent | 62c84297e5340d717d89c5c0b36ed86dd5ad9d2f (diff) |
Use LinkedHashMap in place of HashMap
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)?; |