pub struct JapaneseEngine { /* private fields */ }Expand description
JP engine. One per session. Cheap to construct — all data is in
const tables in crate::romaji and crate::kanji.
Implementations§
Source§impl JapaneseEngine
impl JapaneseEngine
pub fn new() -> Self
Sourcepub fn handle_letter(&mut self, c: u8) -> bool
pub fn handle_letter(&mut self, c: u8) -> bool
Push one ASCII letter into the buffer and re-render candidates.
Returns true if the letter was accepted; rejected letters leave
state unchanged so the IME controller can route the byte elsewhere
(locale punct mapping, raw passthrough).
Accepted bytes:
a-z,A-Z(the romaji alphabet — lowercased on push)-only when the buffer is non-empty — chōonpu (ー / long-vowel mark).romaji::TABLEmaps-toーso a buffer of"koohi-"renders asコーヒー. Empty-buffer-is rejected so a stranded hyphen still routes to the host as ASCII punctuation rather than becoming a leadingーwith no preceding syllable. User-reported 2026-05-27:-must be typeable as JP chōonpu, otherwise long- vowel words like コーヒー are unreachable.
Sourcepub fn backspace(&mut self) -> bool
pub fn backspace(&mut self) -> bool
Pop one byte off the buffer. Returns true if a byte was
removed (i.e. buffer was non-empty), false if there was
nothing to pop.
Sourcepub fn escape(&mut self) -> bool
pub fn escape(&mut self) -> bool
Drop the buffer entirely. Returns true if something was
dropped, false if buffer was already empty.
pub fn is_composing(&self) -> bool
pub fn candidates(&self) -> &[Candidate]
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. None if index is out of range (state
unchanged).
Trait Implementations§
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