Skip to main content

StrokeScheme

Struct StrokeScheme 

Source
pub struct StrokeScheme { /* private fields */ }

Implementations§

Source§

impl StrokeScheme

Source

pub fn new() -> Self

Source

pub fn reset(&mut self)

Source

pub fn handle_key(&mut self, key: SchemeKey) -> bool

笔画键追加一笔;通配符只在已有笔画时追加;Backspace 删最后一笔。达到 MAX_STROKES 后不再追加。其他键(别的字母、大写、符号)都不改变组合,是否吞掉由会话决定。

Source

pub fn set_raw_input(&mut self, raw: &str)

用宿主编辑后的文本替换组合:笔画键和通配符原样保留,笔画字形换回对应的键,其他字符丢弃,超出 MAX_STROKES 的部分截掉。

Source

pub fn input(&self) -> &str

键入的笔画字母(hspnzx),Enter 上屏的就是它。

Source

pub fn is_empty(&self) -> bool

Source

pub fn glyphs(&self) -> String

组合显示的笔画字形,例如 一丨*。

Source

pub fn glyphs_into(&self, output: &mut String)

Source

pub fn build_request(&self) -> QueryRequest

会话刷新用的请求。raw_input 是键入的字母,也是宿主编辑的文本;normalized_segmentation 是快照 reading 带给宿主绘制的笔画字形。

Source

pub fn build_request_into(&self, request: &mut QueryRequest)

Source

pub fn preedit(&self) -> String

会话显示并据以判断是否在组合的文本:笔画字形,没有组合时为空。

Source

pub fn candidates( &self, dictionary: &LanguageDictionary, ) -> Result<Vec<StrokeCandidate>>

组合的候选,每个字只列一次:

  1. 有字频、笔画码与键入完全相同的字(通配符匹配任意一笔),重的在前;
  2. 有字频、以键入笔画开头、笔画更多的字,重的在前;
  3. 没有字频的字(权重为 0 的生僻字),同样精确匹配在前、补全在后。

笔数恰好打满时,生僻字的精确匹配不再挡在常用字的补全前面。

Trait Implementations§

Source§

impl Clone for StrokeScheme

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StrokeScheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StrokeScheme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.