pub struct Config {
pub root_folder: String,
pub setting_file_path: String,
}Expand description
describe configuration folder
Fields§
§root_folder: StringConfiguration folder path.
setting_file_path: Stringconfig file.
Implementations§
Source§impl Config
impl Config
Sourcepub fn get_settings_from_file(&self) -> AnyResult<Settings>
pub fn get_settings_from_file(&self) -> AnyResult<Settings>
Convert user settings yaml to struct.
§Errors
Will return Err has an error when loading the config file
Sourcepub fn manage_setting_file(&self) -> AnyResult<()>
pub fn manage_setting_file(&self) -> AnyResult<()>
Manage setting folder & file.
- Create config folder if not exists.
- Create default config yaml file if not exists.
§Errors
Will return Err file could not created or loaded
Sourcepub fn update_challenge(&self, challenge: Challenge) -> AnyResult<()>
pub fn update_challenge(&self, challenge: Challenge) -> AnyResult<()>
Sourcepub fn reset_config(&self, force_selection: Option<usize>) -> AnyResult<()>
pub fn reset_config(&self, force_selection: Option<usize>) -> AnyResult<()>
Reset user configuration to the default app.
§Errors
Will return Err create config folder return an error
Trait Implementations§
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more