CodebookConfig

Struct CodebookConfig 

Source
pub struct CodebookConfig {
    pub cache_dir: PathBuf,
    /* private fields */
}

Fields§

§cache_dir: PathBuf

Directory for caching

Implementations§

Source§

impl CodebookConfig

Source

pub fn load(current_dir: Option<&Path>) -> Result<Self, Error>

Load configuration by searching for both global and project-specific configs

Source

pub fn snapshot(&self) -> Arc<ConfigSettings>

Get current configuration snapshot (cheap to clone)

Source

pub fn reload(&self) -> Result<bool, Error>

Reload both global and project configurations, only reading files if they’ve changed

Source

pub fn add_word(&self, word: &str) -> Result<bool, Error>

Add a word to the project configs allowlist

Source

pub fn add_word_global(&self, word: &str) -> Result<bool, Error>

Add a word to the global configs allowlist

Source

pub fn add_ignore(&self, file: &str) -> Result<bool, Error>

Add a file to the ignore list

Source

pub fn save(&self) -> Result<(), Error>

Save the project configuration to its file

Source

pub fn save_global(&self) -> Result<(), Error>

Save the global configuration to its file

Source

pub fn get_dictionary_ids(&self) -> Vec<String>

Get dictionary IDs from effective configuration

Source

pub fn should_ignore_path<P: AsRef<Path>>(&self, path: P) -> bool

Check if a path should be ignored based on the effective configuration

Source

pub fn is_allowed_word(&self, word: &str) -> bool

Check if a word is in the effective allowlist

Source

pub fn should_flag_word(&self, word: &str) -> bool

Check if a word should be flagged according to effective configuration

Source

pub fn get_ignore_patterns(&self) -> Option<Vec<Regex>>

Get the list of user-defined ignore patterns

Source

pub fn get_min_word_length(&self) -> usize

Get the minimum word length which should be checked

Source

pub fn clean_cache(&self)

Clean the cache directory

Source

pub fn project_config_path(&self) -> Option<PathBuf>

Get path to project config if it exists

Source

pub fn global_config_path(&self) -> Option<PathBuf>

Get path to global config if it exists

Trait Implementations§

Source§

impl Debug for CodebookConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CodebookConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, 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.