Struct 数据

Source
pub struct 数据 {
    pub 配置: 配置,
    pub 词列表: Vec<可编码对象>,
    pub 键位分布信息: 键位分布信息,
    pub 当量信息: 当量信息,
    pub 初始映射: 元素映射,
    pub 进制: u64,
    pub 选择键: Vec<>,
    pub 键转数字: FxHashMap<char, >,
    pub 数字转键: FxHashMap<, char>,
    pub 元素转数字: FxHashMap<String, 元素>,
    pub 数字转元素: FxHashMap<元素, String>,
}
Expand description

将用户提供的输入转换为内部数据结构,并提供了一些实用的方法

Fields§

§配置: 配置§词列表: Vec<可编码对象>§键位分布信息: 键位分布信息§当量信息: 当量信息§初始映射: 元素映射§进制: u64§选择键: Vec<>§键转数字: FxHashMap<char, >§数字转键: FxHashMap<, char>§元素转数字: FxHashMap<String, 元素>§数字转元素: FxHashMap<元素, String>

Implementations§

Source§

impl 数据

Source

pub fn 新建( 配置: 配置, 原始词列表: Vec<原始可编码对象>, 原始键位分布信息: 原始键位分布信息, 原始当量信息: 原始当量信息, ) -> Result<Self, 错误>

Source

pub fn 预处理字母表( config: &配置, ) -> Result<(u64, Vec<>, FxHashMap<char, >, FxHashMap<, char>), 错误>

读取字母表和选择键列表,然后分别对它们的每一个按键转换成无符号整数 1, … n = 所有常规编码键 n + 1, …, m = 所有选择键

Source

pub fn 预处理映射( config: &配置, key_repr: &FxHashMap<char, >, radix: u64, ) -> Result<(元素映射, FxHashMap<String, 元素>, FxHashMap<元素, String>), 错误>

读取元素映射,然后把每一个元素转换成无符号整数,从而可以用向量来表示一个元素布局,向量的下标就是元素对应的数

Source

pub fn assemble(element: &String, index: usize) -> String

Source

pub fn 预处理词列表( raw_encodables: Vec<原始可编码对象>, max_length: usize, element_repr: &FxHashMap<String, 元素>, ) -> Result<Vec<可编码对象>, 错误>

读取拆分表,将拆分序列中的每一个元素按照先前确定的元素 -> 整数映射来转换为整数向量

Source

pub fn 生成码表(&self, buffer: &[编码信息]) -> Vec<码表项>

Source

pub fn 更新配置(&self, candidate: &元素映射) -> 配置

根据一个计算中得到的元素布局来生成一份新的配置文件,其余内容不变直接复制过来

Source

pub fn 数字转编码( code: 编码, 进制: u64, repr_key: &FxHashMap<, char>, ) -> Vec<char>

如前所述,建立了一个按键到整数的映射之后,可以将字符串看成具有某个进制的数。所以,给定一个数,也可以把它转化为字符串

Source

pub fn 预处理键位分布信息( key_distribution: &原始键位分布信息, 进制: u64, repr_key: &FxHashMap<, char>, ) -> Vec<键位分布损失函数>

根据编码字符和未归一化的键位分布,生成一个理想的键位分布

Source

pub fn 预处理当量信息( 原始当量信息: &原始当量信息, space: usize, 进制: u64, 数字转键: &FxHashMap<, char>, ) -> Vec<f64>

将编码空间内所有的编码组合预先计算好速度当量 按照这个字符串所对应的整数为下标,存储到一个大数组中

Source

pub fn 预处理指法标记(&self) -> Vec<用指标记>

将编码空间内所有的编码组合预先计算好差指法标记 标记压缩到一个 64 位整数中,每四位表示一个字符的差指法标记 从低位到高位,依次是:同手、同指大跨排、同指小跨排、小指干扰、错手、三连击 按照这个字符串所对应的整数为下标,存储到一个大数组中

Source

pub fn 预处理自动上屏(&self) -> Result<Vec<bool>, 错误>

将编码空间内所有的编码组合预先计算好是否能自动上屏 按照这个字符串所对应的整数为下标,存储到一个大数组中

Source

pub fn 预处理简码规则( &self, schemes: &Vec<Scheme>, ) -> Result<Vec<简码配置>, 错误>

Source

pub fn 预处理简码配置( &self, configs: Vec<ShortCodeConfig>, ) -> Result<[Vec<简码配置>; 10], 错误>

Source

pub fn get_space(&self) -> usize

Trait Implementations§

Source§

impl Clone for 数据

Source§

fn clone(&self) -> 数据

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for 数据

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for 数据

§

impl RefUnwindSafe for 数据

§

impl Send for 数据

§

impl Sync for 数据

§

impl Unpin for 数据

§

impl UnwindSafe for 数据

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V