pub struct FstDictionary { /* private fields */ }Expand description
Dictionary backed by a Gukhanmun FST file.
The fixed header and CBOR metadata are decoded eagerly. The FST map bytes
and reading table share one backing byte source: owned heap bytes for
FstDictionary::open and FstDictionary::from_bytes, or static bytes
for FstDictionary::from_static_bytes.
Implementations§
Source§impl FstDictionary
impl FstDictionary
Sourcepub fn open(path: impl AsRef<Path>) -> Result<FstDictionary, Error>
pub fn open(path: impl AsRef<Path>) -> Result<FstDictionary, Error>
Opens a dictionary file from disk.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<FstDictionary, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<FstDictionary, Error>
Decodes a dictionary from bytes in the Gukhanmun FST file format.
Sourcepub fn from_static_bytes(bytes: &'static [u8]) -> Result<FstDictionary, Error>
pub fn from_static_bytes(bytes: &'static [u8]) -> Result<FstDictionary, Error>
Decodes a dictionary from static bytes in the Gukhanmun FST file format.
This is intended for embedded dictionaries built with include_bytes!.
The FST map and reading table borrow from the static byte slice without
copying either section.
Sourcepub fn metadata(&self) -> &BTreeMap<String, String>
pub fn metadata(&self) -> &BTreeMap<String, String>
Returns build metadata embedded in the dictionary file.
Sourcepub fn entry_count(&self) -> u64
pub fn entry_count(&self) -> u64
Returns the number of entries recorded at build time.
Trait Implementations§
Source§impl Clone for FstDictionary
impl Clone for FstDictionary
Source§fn clone(&self) -> FstDictionary
fn clone(&self) -> FstDictionary
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 FstDictionary
impl Debug for FstDictionary
Source§impl HanjaDictionary for FstDictionary
impl HanjaDictionary for FstDictionary
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.
Auto Trait Implementations§
impl Freeze for FstDictionary
impl RefUnwindSafe for FstDictionary
impl Send for FstDictionary
impl Sync for FstDictionary
impl Unpin for FstDictionary
impl UnsafeUnpin for FstDictionary
impl UnwindSafe for FstDictionary
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