pub struct ConfigBuilder<T> { /* private fields */ }Expand description
Implements a configuration builder.
The builder supports merging multiple TOML configuration files together.
Merging works by the following:
- Matching table keys that are arrays get appended.
- Matching table keys that are tables are recursively merged.
- Otherwise, the value associated with the key is replaced by the configuration being merged in.
The configuration builder is generic so that it can build any type that supports TOML serialization.
Implementations§
Source§impl<T> ConfigBuilder<T>
impl<T> ConfigBuilder<T>
Sourcepub fn with_string_source(self, toml: impl Into<String>) -> Self
pub fn with_string_source(self, toml: impl Into<String>) -> Self
Adds a TOML string source to the builder.
Sourcepub fn with_file_source(self, path: impl Into<PathBuf>) -> Self
pub fn with_file_source(self, path: impl Into<PathBuf>) -> Self
Adds a TOML configuration file source to the builder.
Trait Implementations§
Source§impl<T: Debug> Debug for ConfigBuilder<T>
impl<T: Debug> Debug for ConfigBuilder<T>
Source§impl<T: Default> Default for ConfigBuilder<T>
impl<T: Default> Default for ConfigBuilder<T>
Source§fn default() -> ConfigBuilder<T>
fn default() -> ConfigBuilder<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T> Freeze for ConfigBuilder<T>
impl<T> RefUnwindSafe for ConfigBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for ConfigBuilder<T>where
T: Send,
impl<T> Sync for ConfigBuilder<T>where
T: Sync,
impl<T> Unpin for ConfigBuilder<T>where
T: Unpin,
impl<T> UnsafeUnpin for ConfigBuilder<T>
impl<T> UnwindSafe for ConfigBuilder<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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