pub struct ConfigMap { /* private fields */ }Expand description
Internal data model for configuration values.
Supports two access patterns:
- Flat — top-level
KEY = value(.env, root of JSON/TOML/YAML) - Sectioned —
[section] key = value(INI, nested TOML/JSON/YAML)
Implementations§
Source§impl ConfigMap
impl ConfigMap
Sourcepub fn insert_flat(&mut self, key: String, value: String)
pub fn insert_flat(&mut self, key: String, value: String)
Insert a flat (top-level) key/value pair.
Sourcepub fn insert_sectioned(&mut self, section: String, key: String, value: String)
pub fn insert_sectioned(&mut self, section: String, key: String, value: String)
Insert a sectioned key/value pair.
Sourcepub fn get_in_section(&self, section: &str, key: &str) -> Option<&str>
pub fn get_in_section(&self, section: &str, key: &str) -> Option<&str>
Look up key inside section.
Sourcepub fn get_section(&self, section: &str) -> Option<&IndexMap<String, String>>
pub fn get_section(&self, section: &str) -> Option<&IndexMap<String, String>>
Return all key/value pairs for section.
Sourcepub fn has_section(&self, section: &str) -> bool
pub fn has_section(&self, section: &str) -> bool
True if section exists.
Sourcepub fn flat_iter(&self) -> impl Iterator<Item = (&str, &str)>
pub fn flat_iter(&self) -> impl Iterator<Item = (&str, &str)>
All flat key/value pairs in insertion order.
Sourcepub fn sections(
&self,
) -> impl Iterator<Item = (&str, &IndexMap<String, String>)>
pub fn sections( &self, ) -> impl Iterator<Item = (&str, &IndexMap<String, String>)>
All sections, each yielding its key/value pairs.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
True if the flat map contains key or any section contains key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ConfigMap
impl<'de> Deserialize<'de> for ConfigMap
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConfigMap
impl RefUnwindSafe for ConfigMap
impl Send for ConfigMap
impl Sync for ConfigMap
impl Unpin for ConfigMap
impl UnsafeUnpin for ConfigMap
impl UnwindSafe for ConfigMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more