summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorDavid Orchard <if_coding@fastmail.com>2021-08-01 00:03:10 -0700
committerDavid Orchard <if_coding@fastmail.com>2021-08-15 10:31:58 -0700
commitcc0530a7716779f954b1756905a9f4ceb7eb6d62 (patch)
tree311b2ca44a282bbc629a08123f53a855cba38c1c /src/config.rs
parent622efaca17256fb42dafc61c8df1f3037c1fb772 (diff)
Move order preservation under a feature gate
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/config.rs b/src/config.rs
index 6302c45..8c410f0 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,4 +1,3 @@
-use linked_hash_map::LinkedHashMap;
use std::fmt::Debug;
use crate::builder::{ConfigBuilder, DefaultState};
@@ -6,6 +5,7 @@ use serde::de::Deserialize;
use serde::ser::Serialize;
use crate::error::*;
+use crate::map::MapImpl;
use crate::path;
use crate::ser::ConfigSerializer;
use crate::source::Source;
@@ -16,8 +16,8 @@ use crate::value::{Table, Value};
/// them according to the source's priority.
#[derive(Clone, Debug)]
pub struct Config {
- defaults: LinkedHashMap<path::Expression, Value>,
- overrides: LinkedHashMap<path::Expression, Value>,
+ defaults: MapImpl<path::Expression, Value>,
+ overrides: MapImpl<path::Expression, Value>,
sources: Vec<Box<dyn Source + Send + Sync>>,
/// Root of the cached configuration.
@@ -83,7 +83,7 @@ impl Config {
#[deprecated(since = "0.12.0", note = "please use 'ConfigBuilder' instead")]
pub fn refresh(&mut self) -> Result<&mut Config> {
self.cache = {
- let mut cache: Value = LinkedHashMap::<String, Value>::new().into();
+ let mut cache: Value = MapImpl::<String, Value>::new().into();
// Add defaults
for (key, val) in self.defaults.iter() {
@@ -181,7 +181,7 @@ impl Config {
self.get(key).and_then(Value::into_bool)
}
- pub fn get_table(&self, key: &str) -> Result<LinkedHashMap<String, Value>> {
+ pub fn get_table(&self, key: &str) -> Result<MapImpl<String, Value>> {
self.get(key).and_then(Value::into_table)
}
@@ -212,7 +212,7 @@ impl Source for Config {
Box::new((*self).clone())
}
- fn collect(&self) -> Result<LinkedHashMap<String, Value>> {
+ fn collect(&self) -> Result<MapImpl<String, Value>> {
self.cache.clone().into_table()
}
}