pub struct AppConfig {
pub debug: bool,
pub log_level: LogLevel,
pub database: Database,
}Fields§
§debug: bool§log_level: LogLevel§database: DatabaseImplementations§
Source§impl AppConfig
impl AppConfig
pub fn merge_args(args: ArgMatches) -> Result<()>
Sourcepub fn init_with_args(
default_config: Option<&str>,
args: Option<ArgMatches>,
) -> Result<()>
pub fn init_with_args( default_config: Option<&str>, args: Option<ArgMatches>, ) -> Result<()>
Initialize configuration with proper precedence order:
- Default configuration (embedded)
- Configuration file (if specified)
- Environment variables (APP_*)
- CLI arguments (highest precedence)
pub fn merge_config(config_file: Option<&Path>) -> Result<()>
pub fn set(key: &str, value: &str) -> Result<()>
pub fn get<'de, T>(key: &'de str) -> Result<T>where
T: Deserialize<'de>,
pub fn fetch() -> Result<AppConfig>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnwindSafe for AppConfig
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