summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index c781e9035..cc3beaa5a 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,6 +1,7 @@
use crate::configs::StarshipRootConfig;
use crate::utils;
use ansi_term::{Color, Style};
+use indexmap::IndexMap;
use std::clone::Clone;
use std::collections::HashMap;
@@ -146,6 +147,22 @@ where
}
}
+impl<'a, T, S: ::std::hash::BuildHasher + Default> ModuleConfig<'a> for IndexMap<String, T, S>
+where
+ T: ModuleConfig<'a>,
+ S: Clone,
+{
+ fn from_config(config: &'a Value) -> Option<Self> {
+ let mut im = IndexMap::default();
+
+ for (x, y) in config.as_table()?.iter() {
+ im.insert(x.clone(), T::from_config(y)?);
+ }
+
+ Some(im)
+ }
+}
+
impl<'a, T> ModuleConfig<'a> for Option<T>
where
T: ModuleConfig<'a> + Sized,