pub struct JapaneseEngine { /* private fields */ }Expand description
JP engine wrapping the embedded romaji / jukugo / kanji tables. Cheap to construct (all data is in const tables).
Implementations§
Source§impl JapaneseEngine
impl JapaneseEngine
pub fn new() -> JapaneseEngine
Sourcepub fn handle_letter(&mut self, byte: u8) -> bool
pub fn handle_letter(&mut self, byte: u8) -> bool
Push one ASCII letter byte ('a'..='z', 'A'..='Z') into the
buffer and re-render candidates. The - byte is also accepted
(chōonpu ー) when the buffer is non-empty.
Returns true if the byte was accepted; rejected bytes leave
state unchanged so the host controller can route the byte
elsewhere (locale punct mapping, raw passthrough).
Sourcepub fn backspace(&mut self) -> bool
pub fn backspace(&mut self) -> bool
Pop one byte off the buffer. Returns true if state changed.
pub fn is_composing(&self) -> bool
Sourcepub fn candidates(&self) -> Array
pub fn candidates(&self) -> Array
Current candidates as a js_sys::Array of Objects. Each
object carries:
word: stringkind: KanaKind(enum numeric value)freq: number(0–100, higher = more common)composed: boolean(truefor mechanicalcompose_sentenceproducts — particle/copula glue)proximityMilli: number(1000 = exact match, < 1000 = prefix-prediction candidate whose reading the buffer is only a prefix of, e.g.shinjuk → 新宿at 875)
Sourcepub fn commit_index(&mut self, index: usize) -> Option<String>
pub fn commit_index(&mut self, index: usize) -> Option<String>
Commit the candidate at index. Returns the committed text and
clears the buffer. Returns null (via empty JsValue) if
index is out of range; state is unchanged on out-of-range.
Trait Implementations§
Source§impl Default for JapaneseEngine
impl Default for JapaneseEngine
Source§impl From<JapaneseEngine> for JsValue
impl From<JapaneseEngine> for JsValue
Source§fn from(value: JapaneseEngine) -> Self
fn from(value: JapaneseEngine) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for JapaneseEngine
impl FromWasmAbi for JapaneseEngine
Source§impl IntoWasmAbi for JapaneseEngine
impl IntoWasmAbi for JapaneseEngine
Source§impl LongRefFromWasmAbi for JapaneseEngine
impl LongRefFromWasmAbi for JapaneseEngine
Source§type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<JapaneseEngine>
type Anchor = RcRef<JapaneseEngine>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for JapaneseEngine
impl OptionFromWasmAbi for JapaneseEngine
Source§impl OptionIntoWasmAbi for JapaneseEngine
impl OptionIntoWasmAbi for JapaneseEngine
Source§impl RefFromWasmAbi for JapaneseEngine
impl RefFromWasmAbi for JapaneseEngine
Source§type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<JapaneseEngine>
type Anchor = RcRef<JapaneseEngine>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JapaneseEngine
impl RefMutFromWasmAbi for JapaneseEngine
Source§type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
type Abi = WasmPtr<WasmRefCell<JapaneseEngine>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<JapaneseEngine>
type Anchor = RcRefMut<JapaneseEngine>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl TryFromJsValue for JapaneseEngine
impl TryFromJsValue for JapaneseEngine
Source§impl VectorFromWasmAbi for JapaneseEngine
impl VectorFromWasmAbi for JapaneseEngine
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JapaneseEngine]>
Source§impl VectorIntoWasmAbi for JapaneseEngine
impl VectorIntoWasmAbi for JapaneseEngine
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JapaneseEngine]>) -> Self::Abi
Source§impl WasmDescribeVector for JapaneseEngine
impl WasmDescribeVector for JapaneseEngine
impl SupportsConstructor for JapaneseEngine
impl SupportsInstanceProperty for JapaneseEngine
impl SupportsStaticProperty for JapaneseEngine
Auto Trait Implementations§
impl Freeze for JapaneseEngine
impl RefUnwindSafe for JapaneseEngine
impl Send for JapaneseEngine
impl Sync for JapaneseEngine
impl Unpin for JapaneseEngine
impl UnsafeUnpin for JapaneseEngine
impl UnwindSafe for JapaneseEngine
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
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.