pub struct DictionaryComposer { /* private fields */ }Expand description
使用所选语言的现有词库提供者组成完整混合路径。构造应在会话准备阶段完成,
不要在每次按键时重建。它持有独立查询状态,中文 n 元表和日文模型仍由现有缓存共享。
语言集合或模型路径改变时重建;词典修订到达时调用 Self::clear。
Implementations§
Source§impl DictionaryComposer
impl DictionaryComposer
Sourcepub fn new(paths: &RuntimePaths, languages: &[Language]) -> Self
pub fn new(paths: &RuntimePaths, languages: &[Language]) -> Self
只打开显式选择的语言,缺失资源按原有提供者语义返回没有词条,不下载或补写资源。
Sourcepub fn with_japanese_model(
paths: &RuntimePaths,
languages: &[Language],
model: &Path,
) -> Self
pub fn with_japanese_model( paths: &RuntimePaths, languages: &[Language], model: &Path, ) -> Self
使用宿主已解析的日文资源包路径,其它词库仍取同一份运行时目录。
Sourcepub fn warm_up_in_background(&self)
pub fn warm_up_in_background(&self)
会话准备时沿现有提供者预热;未选日文时不读模型,不等待后台完成。
Sourcepub fn convert(&mut self, input: &str) -> Option<Conversion>
pub fn convert(&mut self, input: &str) -> Option<Conversion>
只返回全串覆盖的混合备选,完整中文的存在性由 chinese_complete 保留。
当前仅接受小写拉丁编码;非法输入或预算不足时不返回部分路径。
Auto Trait Implementations§
impl !Freeze for DictionaryComposer
impl !RefUnwindSafe for DictionaryComposer
impl !Sync for DictionaryComposer
impl !UnwindSafe for DictionaryComposer
impl Send for DictionaryComposer
impl Unpin for DictionaryComposer
impl UnsafeUnpin for DictionaryComposer
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