pub struct StrokeScheme { /* private fields */ }Implementations§
Source§impl StrokeScheme
impl StrokeScheme
pub fn new() -> Self
pub fn reset(&mut self)
Sourcepub fn handle_key(&mut self, key: SchemeKey) -> bool
pub fn handle_key(&mut self, key: SchemeKey) -> bool
笔画键追加一笔;通配符只在已有笔画时追加;Backspace 删最后一笔。达到 MAX_STROKES 后不再追加。其他键(别的字母、大写、符号)都不改变组合,是否吞掉由会话决定。
Sourcepub fn set_raw_input(&mut self, raw: &str)
pub fn set_raw_input(&mut self, raw: &str)
用宿主编辑后的文本替换组合:笔画键和通配符原样保留,笔画字形换回对应的键,其他字符丢弃,超出 MAX_STROKES 的部分截掉。
pub fn is_empty(&self) -> bool
pub fn glyphs_into(&self, output: &mut String)
Sourcepub fn build_request(&self) -> QueryRequest
pub fn build_request(&self) -> QueryRequest
会话刷新用的请求。raw_input 是键入的字母,也是宿主编辑的文本;normalized_segmentation 是快照 reading 带给宿主绘制的笔画字形。
pub fn build_request_into(&self, request: &mut QueryRequest)
Sourcepub fn candidates(
&self,
dictionary: &LanguageDictionary,
) -> Result<Vec<StrokeCandidate>>
pub fn candidates( &self, dictionary: &LanguageDictionary, ) -> Result<Vec<StrokeCandidate>>
组合的候选,每个字只列一次:
- 有字频、笔画码与键入完全相同的字(通配符匹配任意一笔),重的在前;
- 有字频、以键入笔画开头、笔画更多的字,重的在前;
- 没有字频的字(权重为 0 的生僻字),同样精确匹配在前、补全在后。
笔数恰好打满时,生僻字的精确匹配不再挡在常用字的补全前面。
Trait Implementations§
Source§impl Clone for StrokeScheme
impl Clone for StrokeScheme
Source§impl Debug for StrokeScheme
impl Debug for StrokeScheme
Auto Trait Implementations§
impl Freeze for StrokeScheme
impl RefUnwindSafe for StrokeScheme
impl Send for StrokeScheme
impl Sync for StrokeScheme
impl Unpin for StrokeScheme
impl UnsafeUnpin for StrokeScheme
impl UnwindSafe for StrokeScheme
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