pub struct ConfigBuilder { /* private fields */ }Expand description
配置构建器
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn add_yaml_file<P: AsRef<Path>>(self, path: P) -> Self
pub fn add_yaml_file<P: AsRef<Path>>(self, path: P) -> Self
添加 YAML 配置文件
Sourcepub fn add_toml_file<P: AsRef<Path>>(self, path: P) -> Self
pub fn add_toml_file<P: AsRef<Path>>(self, path: P) -> Self
添加 TOML 配置文件
Sourcepub fn add_json_file<P: AsRef<Path>>(self, path: P) -> Self
pub fn add_json_file<P: AsRef<Path>>(self, path: P) -> Self
添加 JSON 配置文件
Sourcepub fn with_env_prefix<S: Into<String>>(self, prefix: S) -> Self
pub fn with_env_prefix<S: Into<String>>(self, prefix: S) -> Self
Sourcepub fn with_env_separator<S: Into<String>>(self, separator: S) -> Self
pub fn with_env_separator<S: Into<String>>(self, separator: S) -> Self
Sourcepub fn ignore_missing_files(self, ignore: bool) -> Self
pub fn ignore_missing_files(self, ignore: bool) -> Self
设置是否忽略缺失的配置文件
Sourcepub fn with_default<K, V>(self, key: K, value: V) -> Result<Self>
pub fn with_default<K, V>(self, key: K, value: V) -> Result<Self>
Sourcepub fn build<T>(self) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub fn build<T>(self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
Returns a duplicate 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 moreSource§impl Debug for ConfigBuilder
impl Debug for ConfigBuilder
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