pub struct Config {
pub debug: u8,
pub config_path: PathBuf,
pub config_data: ConfigData,
}
Expand description
Configuration object It’s linked to a configuration file
Fields§
§debug: u8
debug level
config_path: PathBuf
path to the configuration file
config_data: ConfigData
actual configuration data
Implementations§
source§impl Config
impl Config
sourcefn parse_config(str_config: &str, path_config: PathBuf) -> Config
fn parse_config(str_config: &str, path_config: PathBuf) -> Config
Parse the config file
sourcepub fn new_from_path(custom_path: &PathBuf) -> Config
pub fn new_from_path(custom_path: &PathBuf) -> Config
Create a new Config object from a custom path
sourcepub fn get_config_path() -> PathBuf
pub fn get_config_path() -> PathBuf
Get the path to the config file
sourcepub fn update(
&mut self,
updater_fn: impl FnOnce(&mut ConfigData) -> &mut ConfigData,
)
pub fn update( &mut self, updater_fn: impl FnOnce(&mut ConfigData) -> &mut ConfigData, )
Update the config data and save it to the config file
Trait Implementations§
source§impl CliCommand for Config
impl CliCommand for Config
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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 Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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