pub struct CodebookConfig {
pub project_config_path: Option<PathBuf>,
pub global_config_path: Option<PathBuf>,
pub cache_dir: PathBuf,
/* private fields */
}Fields§
§project_config_path: Option<PathBuf>Path to the project-specific config file
global_config_path: Option<PathBuf>Path to the global config file
cache_dir: PathBufDirectory for caching
Implementations§
Source§impl CodebookConfig
impl CodebookConfig
Sourcepub fn load(current_dir: Option<&Path>) -> Result<Self, Error>
pub fn load(current_dir: Option<&Path>) -> Result<Self, Error>
Load configuration by searching for both global and project-specific configs
Sourcepub fn reload(&self) -> Result<bool, Error>
pub fn reload(&self) -> Result<bool, Error>
Reload both global and project configurations, only reading files if they’ve changed
Sourcepub fn add_word(&self, word: &str) -> Result<bool, Error>
pub fn add_word(&self, word: &str) -> Result<bool, Error>
Add a word to the project configs allowlist
Sourcepub fn add_word_global(&self, word: &str) -> Result<bool, Error>
pub fn add_word_global(&self, word: &str) -> Result<bool, Error>
Add a word to the global configs allowlist
Sourcepub fn save_global(&self) -> Result<(), Error>
pub fn save_global(&self) -> Result<(), Error>
Save the global configuration to its file
Sourcepub fn get_dictionary_ids(&self) -> Vec<String>
pub fn get_dictionary_ids(&self) -> Vec<String>
Get dictionary IDs from effective configuration
Sourcepub fn should_ignore_path<P: AsRef<Path>>(&self, path: P) -> bool
pub fn should_ignore_path<P: AsRef<Path>>(&self, path: P) -> bool
Check if a path should be ignored based on the effective configuration
Sourcepub fn is_allowed_word(&self, word: &str) -> bool
pub fn is_allowed_word(&self, word: &str) -> bool
Check if a word is in the effective allowlist
Sourcepub fn should_flag_word(&self, word: &str) -> bool
pub fn should_flag_word(&self, word: &str) -> bool
Check if a word should be flagged according to effective configuration
Sourcepub fn get_ignore_patterns(&self) -> Option<Vec<Regex>>
pub fn get_ignore_patterns(&self) -> Option<Vec<Regex>>
Get the list of user-defined ignore patterns
Sourcepub fn clean_cache(&self)
pub fn clean_cache(&self)
Clean the cache directory
Trait Implementations§
Source§impl Debug for CodebookConfig
impl Debug for CodebookConfig
Auto Trait Implementations§
impl !Freeze for CodebookConfig
impl RefUnwindSafe for CodebookConfig
impl Send for CodebookConfig
impl Sync for CodebookConfig
impl Unpin for CodebookConfig
impl UnwindSafe for CodebookConfig
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