pub struct ConfigLayer {
pub source: ConfigSource,
/* private fields */
}Expand description
A deterministic map of configuration values paired with source metadata.
Fields§
§source: ConfigSourceSource metadata for this layer.
Implementations§
Source§impl ConfigLayer
impl ConfigLayer
Sourcepub const fn new(source: ConfigSource) -> ConfigLayer
pub const fn new(source: ConfigSource) -> ConfigLayer
Creates an empty layer for a source.
Sourcepub const fn from_values(
source: ConfigSource,
values: BTreeMap<ConfigPath, ConfigValue>,
) -> ConfigLayer
pub const fn from_values( source: ConfigSource, values: BTreeMap<ConfigPath, ConfigValue>, ) -> ConfigLayer
Creates a layer from source metadata and values.
Sourcepub const fn source(&self) -> &ConfigSource
pub const fn source(&self) -> &ConfigSource
Returns the layer source.
Sourcepub const fn values(&self) -> &BTreeMap<ConfigPath, ConfigValue>
pub const fn values(&self) -> &BTreeMap<ConfigPath, ConfigValue>
Returns the deterministic value map.
Sourcepub fn insert(
&mut self,
path: ConfigPath,
value: ConfigValue,
) -> Option<ConfigValue>
pub fn insert( &mut self, path: ConfigPath, value: ConfigValue, ) -> Option<ConfigValue>
Inserts a path value into the layer.
Sourcepub fn get(&self, path: &ConfigPath) -> Option<&ConfigValue>
pub fn get(&self, path: &ConfigPath) -> Option<&ConfigValue>
Returns a value for a path.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&ConfigPath, &ConfigValue)>
pub fn iter(&self) -> impl Iterator<Item = (&ConfigPath, &ConfigValue)>
Iterates over values in deterministic path order.
Trait Implementations§
Source§impl Clone for ConfigLayer
impl Clone for ConfigLayer
Source§fn clone(&self) -> ConfigLayer
fn clone(&self) -> ConfigLayer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfigLayer
impl Debug for ConfigLayer
Source§impl PartialEq for ConfigLayer
impl PartialEq for ConfigLayer
Source§fn eq(&self, other: &ConfigLayer) -> bool
fn eq(&self, other: &ConfigLayer) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConfigLayer
Auto Trait Implementations§
impl Freeze for ConfigLayer
impl RefUnwindSafe for ConfigLayer
impl Send for ConfigLayer
impl Sync for ConfigLayer
impl Unpin for ConfigLayer
impl UnsafeUnpin for ConfigLayer
impl UnwindSafe for ConfigLayer
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