pub struct ConfigLayer {
pub source: ConfigSource,
pub path: Option<PathBuf>,
pub data: Config,
}
Expand description
Set of configuration variables with source information.
Fields§
§source: ConfigSource
Source type of this layer.
path: Option<PathBuf>
Source file path of this layer if any.
data: Config
Configuration variables.
Implementations§
Source§impl ConfigLayer
impl ConfigLayer
Sourcepub fn with_data(source: ConfigSource, data: Config) -> Self
pub fn with_data(source: ConfigSource, data: Config) -> Self
Creates new layer with the configuration variables data
.
Sourcepub fn parse(source: ConfigSource, text: &str) -> Result<Self, ConfigError>
pub fn parse(source: ConfigSource, text: &str) -> Result<Self, ConfigError>
Parses TOML document text
into new layer.
Sourcepub fn look_up_item(
&self,
name: impl ToConfigNamePath,
) -> Result<Option<&ConfigValue>, &ConfigValue>
pub fn look_up_item( &self, name: impl ToConfigNamePath, ) -> Result<Option<&ConfigValue>, &ConfigValue>
Looks up item by the name
path. Returns Some(item)
if an item
found at the path. Returns Err(item)
if middle node wasn’t a table.
Trait Implementations§
Source§impl Clone for ConfigLayer
impl Clone for ConfigLayer
Source§fn clone(&self) -> ConfigLayer
fn clone(&self) -> ConfigLayer
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ConfigLayer
impl !RefUnwindSafe for ConfigLayer
impl Send for ConfigLayer
impl Sync for ConfigLayer
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more