pub struct RuestConfig { /* private fields */ }Expand description
Global configuration accessor (env, .env, TOML, YAML, JSON).
Implementations§
Source§impl RuestConfig
impl RuestConfig
Sourcepub fn load(path: Option<&Path>) -> Result<Self, ConfigError>
pub fn load(path: Option<&Path>) -> Result<Self, ConfigError>
Load configuration with optional file path.
Sourcepub fn get<T: for<'de> Deserialize<'de>>(
&self,
key: &str,
) -> Result<T, ConfigError>
pub fn get<T: for<'de> Deserialize<'de>>( &self, key: &str, ) -> Result<T, ConfigError>
Get a configuration value by key.
Sourcepub fn get_optional<T: for<'de> Deserialize<'de>>(
&self,
key: &str,
) -> Result<Option<T>, ConfigError>
pub fn get_optional<T: for<'de> Deserialize<'de>>( &self, key: &str, ) -> Result<Option<T>, ConfigError>
Get optional value.
Trait Implementations§
Source§impl Clone for RuestConfig
impl Clone for RuestConfig
Source§fn clone(&self) -> RuestConfig
fn clone(&self) -> RuestConfig
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 moreAuto Trait Implementations§
impl Freeze for RuestConfig
impl !RefUnwindSafe for RuestConfig
impl Send for RuestConfig
impl Sync for RuestConfig
impl Unpin for RuestConfig
impl UnsafeUnpin for RuestConfig
impl !UnwindSafe for RuestConfig
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