Skip to main content

KeyGrid

Enum KeyGrid 

Source
pub enum KeyGrid {
    NineKey,
    FourteenKey,
    EighteenKey,
    NineKeyShuangpin(&'static NineKeyShuangpin),
    FourteenKeyShuangpin(&'static NineKeyShuangpin),
    EighteenKeyShuangpin(&'static NineKeyShuangpin),
}
Expand description

九宫格会话把字母归成组码用的键盘。一个组码键上有几个字母,解码只认组码:路径搜索、锁定、切分、整句、简拼和英文混入都与「字母怎么变成码」无关,只经由这里的表。

九键双拼不按字母归组,而是一个音节两位数字(声母一位、韵母一位),表由用户选的方案给出,所以它带着那张表(进程里按内容只留一份,见 nine_key_shuangpin);相等按表的引用比较。

Variants§

§

NineKey

电话键盘:组码是 2–9。

§

FourteenKey

全拼 14 键:组码是每组首字母的小写 q e t u o a d g j l z c b m。

§

EighteenKey

全拼十八键:八组双字母键与十组单字母键。

§

NineKeyShuangpin(&'static NineKeyShuangpin)

九键双拼:组码是方案用到的数字,可以有 1 和 0。

§

FourteenKeyShuangpin(&'static NineKeyShuangpin)

14 键双拼:当前 26 键方案投到相邻字母组,每个音节仍占两键,分号与 L 共键。

§

EighteenKeyShuangpin(&'static NineKeyShuangpin)

双拼 18 键:按 Q WE RT Y U IO P/A SD FG H JK L/Z XC V BN M 分组。

Implementations§

Source§

impl KeyGrid

Source

pub fn code_of(self, letter: u8) -> Option<u8>

字母所在键的组码;十八键双拼的大写字母标记精确输入。字母双拼网格的分号归入 L,九键双拼不按字母归组。

Source

pub fn letters(self, code: u8) -> &'static str

组码键上的字母;不是这种键盘的组码时为空。九键双拼是这个键上能起头一个音节的字母(声母的首字母和从这个键开始的零声母音节的首字母)。

Source

pub fn is_code(self, byte: u8) -> bool

byte 是这种键盘的一个组码键。九键双拼是方案用到的数字。

Source

pub fn encode(self, pinyin: &str) -> String

拼音(或任何字母串)的组码;a..=z 以外的字节(')跳过。九键双拼按 ' 分开的音节编码,完整音节两位、单独的声母一位,有一段两样都不是时为空。

Source

pub fn offers_raw_key(self) -> bool

组码本身是不是可上屏的文字。九键的数字是:左列在没有锁定时给出「原样上屏这一键」,CommitRaw 上屏数字。十四键或十八键的组码只是这一组的首字母,原样上屏没有意义:左列没有这一项,CommitRaw 改为结束组字。九键双拼的数字和九键一样是数字本身。

Source

pub fn uses_digits(self) -> bool

组码是数字,从 character 进来:九键和九键双拼。数字在这两种网格下是组字的键,不是选词键。

Trait Implementations§

Source§

impl Clone for KeyGrid

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 Copy for KeyGrid

Source§

impl Debug for KeyGrid

Source§

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

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

impl Eq for KeyGrid

Source§

impl Hash for KeyGrid

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for KeyGrid

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.