pub struct DictionariesConfig {
pub dictionaries: HashMap<String, DictionaryConfig>,
pub compression: HashMap<String, CompressionConfig>,
pub settings: Settings,
}Expand description
Collection of dictionary configurations loaded from TOML files.
Fields§
§dictionaries: HashMap<String, DictionaryConfig>Map of dictionary names to their configurations
compression: HashMap<String, CompressionConfig>Compression algorithm configurations
settings: SettingsGlobal settings
Implementations§
Source§impl DictionariesConfig
impl DictionariesConfig
Sourcepub fn from_toml(content: &str) -> Result<Self, Error>
pub fn from_toml(content: &str) -> Result<Self, Error>
Parses dictionary configurations from TOML content.
Sourcepub fn load_default() -> Result<Self, Box<dyn Error>>
pub fn load_default() -> Result<Self, Box<dyn Error>>
Loads the built-in dictionary configurations.
Returns the default alphabets bundled with the library.
Sourcepub fn load_from_file(path: &Path) -> Result<Self, Box<dyn Error>>
pub fn load_from_file(path: &Path) -> Result<Self, Box<dyn Error>>
Loads configuration from a custom file path.
Sourcepub fn load_with_overrides() -> Result<Self, Box<dyn Error>>
pub fn load_with_overrides() -> Result<Self, Box<dyn Error>>
Loads configuration with user overrides from standard locations.
Searches in priority order:
- Built-in dictionaries (from library)
~/.config/base-d/dictionaries.toml(user overrides)./dictionaries.toml(project-local overrides)
Later configurations override earlier ones for matching dictionary names.
Sourcepub fn merge(&mut self, other: DictionariesConfig)
pub fn merge(&mut self, other: DictionariesConfig)
Merges another configuration into this one.
Alphabets from other override alphabets with the same name in self.
Sourcepub fn get_dictionary(&self, name: &str) -> Option<&DictionaryConfig>
pub fn get_dictionary(&self, name: &str) -> Option<&DictionaryConfig>
Retrieves an dictionary configuration by name.
Trait Implementations§
Source§impl Debug for DictionariesConfig
impl Debug for DictionariesConfig
Source§impl<'de> Deserialize<'de> for DictionariesConfig
impl<'de> Deserialize<'de> for DictionariesConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DictionariesConfig
impl RefUnwindSafe for DictionariesConfig
impl Send for DictionariesConfig
impl Sync for DictionariesConfig
impl Unpin for DictionariesConfig
impl UnwindSafe for DictionariesConfig
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