pub struct MergedDictionary { /* private fields */ }Expand description
A simple wrapper over Dictionary that allows
one to merge multiple dictionaries without copying.
In cases where more than one dictionary contains a word, data in the first dictionary inserted will be returned.
Implementations§
Source§impl MergedDictionary
impl MergedDictionary
pub fn new() -> Self
pub fn add_dictionary(&mut self, dictionary: Arc<dyn Dictionary>)
Trait Implementations§
Source§impl Clone for MergedDictionary
impl Clone for MergedDictionary
Source§fn clone(&self) -> MergedDictionary
fn clone(&self) -> MergedDictionary
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for MergedDictionary
impl Default for MergedDictionary
Source§impl Dictionary for MergedDictionary
impl Dictionary for MergedDictionary
fn get_correct_capitalization_of(&self, word: &[char]) -> Option<&[char]>
Source§fn contains_word(&self, word: &[char]) -> bool
fn contains_word(&self, word: &[char]) -> bool
Check if the dictionary contains any capitalization of a given word.
Source§fn contains_exact_word(&self, word: &[char]) -> bool
fn contains_exact_word(&self, word: &[char]) -> bool
Check if the dictionary contains the exact capitalization of a given word.
Source§fn get_word_metadata(&self, word: &[char]) -> Option<Cow<'_, DictWordMetadata>>
fn get_word_metadata(&self, word: &[char]) -> Option<Cow<'_, DictWordMetadata>>
Get the associated
DictWordMetadata for any capitalization of a given word.Source§fn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>
fn words_iter(&self) -> Box<dyn Iterator<Item = &[char]> + Send + '_>
Iterate over the words in the dictionary.
Source§fn contains_word_str(&self, word: &str) -> bool
fn contains_word_str(&self, word: &str) -> bool
Check if the dictionary contains any capitalization of a given word.
Source§fn contains_exact_word_str(&self, word: &str) -> bool
fn contains_exact_word_str(&self, word: &str) -> bool
Check if the dictionary contains the exact capitalization of a given word.
Source§fn get_word_metadata_str(&self, word: &str) -> Option<Cow<'_, DictWordMetadata>>
fn get_word_metadata_str(&self, word: &str) -> Option<Cow<'_, DictWordMetadata>>
Get the associated
DictWordMetadata for any capitalization of a given word.
If the word isn’t in the dictionary, the resulting metadata will be
empty.Source§fn fuzzy_match(
&self,
word: &[char],
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>
fn fuzzy_match( &self, word: &[char], max_distance: u8, max_results: usize, ) -> Vec<FuzzyMatchResult<'_>>
Gets best fuzzy match from dictionary
Source§fn fuzzy_match_str(
&self,
word: &str,
max_distance: u8,
max_results: usize,
) -> Vec<FuzzyMatchResult<'_>>
fn fuzzy_match_str( &self, word: &str, max_distance: u8, max_results: usize, ) -> Vec<FuzzyMatchResult<'_>>
Gets best fuzzy match from dictionary
Source§fn word_count(&self) -> usize
fn word_count(&self) -> usize
The number of words in the dictionary.
Source§fn get_word_from_id(&self, id: &WordId) -> Option<&[char]>
fn get_word_from_id(&self, id: &WordId) -> Option<&[char]>
Returns the correct capitalization of the word with the given ID.
Source§impl PartialEq for MergedDictionary
impl PartialEq for MergedDictionary
Auto Trait Implementations§
impl Freeze for MergedDictionary
impl !RefUnwindSafe for MergedDictionary
impl Send for MergedDictionary
impl Sync for MergedDictionary
impl Unpin for MergedDictionary
impl !UnwindSafe for MergedDictionary
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more