pub struct ConfigBuilder { /* private fields */ }Expand description
Configuration builder for fluent API
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn add_file<P: AsRef<Path>>(self, path: P) -> Result<Self, UtilsError>
pub fn add_file<P: AsRef<Path>>(self, path: P) -> Result<Self, UtilsError>
Add configuration from file
Sourcepub fn add_env(self, prefix: &str) -> Result<Self, UtilsError>
pub fn add_env(self, prefix: &str) -> Result<Self, UtilsError>
Add environment variables with prefix
Sourcepub fn add_args(self) -> Result<Self, UtilsError>
pub fn add_args(self) -> Result<Self, UtilsError>
Add command-line arguments
Sourcepub fn set_default(self, key: &str, value: ConfigValue) -> Self
pub fn set_default(self, key: &str, value: ConfigValue) -> Self
Set a default value
Sourcepub fn validate<F>(self, validator: F) -> Result<Self, UtilsError>
pub fn validate<F>(self, validator: F) -> Result<Self, UtilsError>
Validate the configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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> 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