Skip to main content

ImeState

Struct ImeState 

Source
pub struct ImeState {
    pub mode: ImeMode,
    pub dictionary: BTreeMap<String, Vec<DictEntry>>,
    pub dict_loaded: bool,
    pub composing: bool,
    pub romaji_buf: String,
    pub kana_buf: String,
    pub converting: bool,
    pub candidates: Vec<String>,
    pub selected_idx: usize,
}

Fields§

§mode: ImeMode§dictionary: BTreeMap<String, Vec<DictEntry>>§dict_loaded: bool§composing: bool§romaji_buf: String§kana_buf: String§converting: bool§candidates: Vec<String>§selected_idx: usize

Implementations§

Source§

impl ImeState

Source

pub const fn new() -> Self

Source

pub fn load_dict(&mut self)

Source

pub fn toggle_mode(&mut self, to_japanese: bool)

Source

pub fn clear(&mut self)

Source

pub fn input_char(&mut self, c: char)

Source

pub fn backspace(&mut self)

Source

fn convert_romaji(&mut self)

Source

fn flush_pending_romaji(&mut self)

Source

pub fn handle_space(&mut self) -> bool

Source

fn build_conversion_candidates(&mut self)

Source

pub fn handle_enter(&mut self) -> Option<String>

Source

pub fn cancel(&mut self)

Escape キー: 変換中なら変換をキャンセルしてひらがなに戻る。未変換なら全クリア。

Source

pub fn select_candidate_by_number(&mut self, n: usize) -> Option<String>

数字キー(1〜9)で候補を直接選択して確定。確定テキストを返す。

Source

pub fn get_display_text(&self) -> String

Trait Implementations§

Source§

impl Default for ImeState

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> 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, 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.