pub struct ConfigStorage { /* private fields */ }Implementations§
Source§impl ConfigStorage
impl ConfigStorage
pub fn new(config_file: &Path) -> Result<Self>
Sourcepub fn load_config(&mut self) -> Result<()>
pub fn load_config(&mut self) -> Result<()>
Loads configuration from config.toml, or creates default if it doesn’t exist.
Sourcepub fn save_config(&self) -> Result<()>
pub fn save_config(&self) -> Result<()>
Saves the current configuration to config.toml.
pub fn get_config(&self) -> &AppConfig
Sourcepub fn try_set_value(&mut self, key_path: &str, value: &str) -> Result<()>
pub fn try_set_value(&mut self, key_path: &str, value: &str) -> Result<()>
Sets a configuration value at the given key path (e.g., “github.api_token”).
Sourcepub fn try_get_value<T>(&self, key_path: &str) -> Result<T>where
T: DeserializeOwned,
pub fn try_get_value<T>(&self, key_path: &str) -> Result<T>where
T: DeserializeOwned,
Gets a configuration value at the given key path.
Sourcepub fn get_flattened_config(&self) -> HashMap<String, String>
pub fn get_flattened_config(&self) -> HashMap<String, String>
Gets all configuration keys and values as flattened dot-notation paths.
Sourcepub fn reset_to_defaults(&mut self) -> Result<()>
pub fn reset_to_defaults(&mut self) -> Result<()>
Resets all configuration to defaults.
Auto Trait Implementations§
impl Freeze for ConfigStorage
impl RefUnwindSafe for ConfigStorage
impl Send for ConfigStorage
impl Sync for ConfigStorage
impl Unpin for ConfigStorage
impl UnsafeUnpin for ConfigStorage
impl UnwindSafe for ConfigStorage
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