pub struct MapDictionary { /* private fields */ }Expand description
A small in-memory dictionary backed by an ordered map.
This implementation is intended for tests, user-supplied custom entries, and early pipeline validation. It returns all prefix matches at a cursor so the engine can score every candidate path through a hanja run.
Implementations§
Source§impl MapDictionary
impl MapDictionary
Sourcepub fn new() -> MapDictionary
pub fn new() -> MapDictionary
Creates an empty map dictionary.
Sourcepub fn insert(&mut self, hanja: impl Into<String>, reading: impl Into<String>)
pub fn insert(&mut self, hanja: impl Into<String>, reading: impl Into<String>)
Inserts an entry with no special rendering constraints.
Sourcepub fn insert_marked(
&mut self,
hanja: impl Into<String>,
reading: impl Into<String>,
mark: MatchMark,
)
pub fn insert_marked( &mut self, hanja: impl Into<String>, reading: impl Into<String>, mark: MatchMark, )
Inserts an entry with dictionary-provided rendering constraints.
Sourcepub fn insert_with_suffix(
&mut self,
hanja: impl Into<String>,
reading: impl Into<String>,
suffix: impl Into<String>,
)
pub fn insert_with_suffix( &mut self, hanja: impl Into<String>, reading: impl Into<String>, suffix: impl Into<String>, )
Inserts an entry that carries a distinct non-word-initial reading.
suffix is the reading used when the match is not word-initial (see
Match::suffix_reading); reading is the word-initial reading.
Trait Implementations§
Source§impl Clone for MapDictionary
impl Clone for MapDictionary
Source§fn clone(&self) -> MapDictionary
fn clone(&self) -> MapDictionary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MapDictionary
impl Debug for MapDictionary
Source§impl Default for MapDictionary
impl Default for MapDictionary
Source§fn default() -> MapDictionary
fn default() -> MapDictionary
Returns the “default value” for a type. Read more
impl Eq for MapDictionary
Source§impl HanjaDictionary for MapDictionary
impl HanjaDictionary for MapDictionary
Source§fn matches_at<'a>(&'a self, s: &'a str) -> Box<dyn Iterator<Item = Match> + 'a>
fn matches_at<'a>(&'a self, s: &'a str) -> Box<dyn Iterator<Item = Match> + 'a>
Yields every dictionary match that starts at the beginning of
s.Source§fn max_word_chars(&self) -> Option<usize>
fn max_word_chars(&self) -> Option<usize>
Returns the greatest dictionary entry length in Unicode scalar values.
Source§impl PartialEq for MapDictionary
impl PartialEq for MapDictionary
Source§fn eq(&self, other: &MapDictionary) -> bool
fn eq(&self, other: &MapDictionary) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MapDictionary
Auto Trait Implementations§
impl Freeze for MapDictionary
impl RefUnwindSafe for MapDictionary
impl Send for MapDictionary
impl Sync for MapDictionary
impl Unpin for MapDictionary
impl UnsafeUnpin for MapDictionary
impl UnwindSafe for MapDictionary
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.