Config

Struct Config 

Source
pub struct Config {
    pub root_folder: String,
    pub setting_file_path: String,
}
Expand description

describe configuration folder

Fields§

§root_folder: String

Configuration folder path.

§setting_file_path: String

config file.

Implementations§

Source§

impl Config

Source

pub fn new(path: Option<&str>) -> AnyResult<Self>

Get application setting config.

§Errors

Will return Err error return on load/save config

Source

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

Source

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

Source

pub fn update_check_groups(&self, check_groups: Vec<String>) -> AnyResult<()>

Update check groups

§Arguments
  • remove_checks - if true the given check_group parameter will remove from configuration / if false will add.
  • check_groups - list of check groups to act.
§Errors

Will return Err group didn’t added/removed

Source

pub fn update_challenge(&self, challenge: Challenge) -> AnyResult<()>

Update default user challenge.

§Arguments
  • challenge - new challenge to update
§Errors

Will return Err error return on load/save config

Source

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

Source

pub fn update_ignores_pattern_ids( &self, ignores_patterns_ids: Vec<String>, ) -> AnyResult<()>

Update patterns ids to ignore

§Arguments
  • ignores_patterns_ids - Full list of patterns ids
§Errors

Will return Err when could not load/save config

Source

pub fn update_deny_pattern_ids( &self, deny_patterns_ids: Vec<String>, ) -> AnyResult<()>

Update patterns ids to deny

§Arguments
  • deny_patterns_ids - Full list of patterns ids
§Errors

Will return Err when could not load/save config

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V