DictionaryRegistry

Struct DictionaryRegistry 

Source
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: Settings

Global settings

Implementations§

Source§

impl DictionaryRegistry

Source

pub fn from_toml(content: &str) -> Result<Self, Error>

Parses dictionary configurations from TOML content.

Source

pub fn load_default() -> Result<Self, Box<dyn Error>>

Loads the built-in dictionary configurations.

Returns the default dictionaries bundled with the library.

Source

pub fn load_from_file(path: &Path) -> Result<Self, Box<dyn Error>>

Loads configuration from a custom file path.

Source

pub fn load_with_overrides() -> Result<Self, Box<dyn Error>>

Loads configuration with user overrides from standard locations.

Searches in priority order:

  1. Built-in dictionaries (from library)
  2. ~/.config/base-d/dictionaries.toml (user overrides)
  3. ./dictionaries.toml (project-local overrides)

Later configurations override earlier ones for matching dictionary names.

Source

pub fn merge(&mut self, other: DictionaryRegistry)

Merges another configuration into this one.

Dictionaries from other override dictionaries with the same name in self.

Source

pub fn get_dictionary(&self, name: &str) -> Option<&DictionaryConfig>

Retrieves an dictionary configuration by name.

Trait Implementations§

Source§

impl Debug for DictionaryRegistry

Source§

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

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

impl<'de> Deserialize<'de> for DictionaryRegistry

Source§

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§

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> Same for T

Source§

type Output = T

Should always be Self
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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,