pub struct DictionaryRegistry {
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 DictionaryRegistry
impl DictionaryRegistry
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 dictionaries 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: DictionaryRegistry)
pub fn merge(&mut self, other: DictionaryRegistry)
Merges another configuration into this one.
Dictionaries from other override dictionaries 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 DictionaryRegistry
impl Debug for DictionaryRegistry
Source§impl<'de> Deserialize<'de> for DictionaryRegistry
impl<'de> Deserialize<'de> for DictionaryRegistry
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 DictionaryRegistry
impl RefUnwindSafe for DictionaryRegistry
impl Send for DictionaryRegistry
impl Sync for DictionaryRegistry
impl Unpin for DictionaryRegistry
impl UnwindSafe for DictionaryRegistry
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