pub struct Engine { /* private fields */ }Expand description
Page-mode dispatcher.
Implementations§
Source§impl Engine
impl Engine
pub fn new(keymap: Keymap) -> Self
pub fn with_timeout(keymap: Keymap, timeout: Duration) -> Self
pub fn keymap(&self) -> &Keymap
pub fn keymap_mut(&mut self) -> &mut Keymap
Sourcepub fn set_keymap(&mut self, keymap: Keymap)
pub fn set_keymap(&mut self, keymap: Keymap)
Replace the live keymap and reset the pending chord buffer.
Used by hot-reload in apps/buffr so config edits swap bindings
without restarting CEF.
pub fn mode(&self) -> PageMode
Sourcepub fn count_buffer(&self) -> Option<u32>
pub fn count_buffer(&self) -> Option<u32>
Pending count buffer surfaced for the statusline. None when
no count has accumulated yet (the next count-bearing action
will get an implicit 1); Some(n) once the user has typed
at least one digit.
This is the chrome-friendly companion to Engine::count —
count returns the raw u32 (0 for “none”) which conflates
the absence of a count with the unrepresentable count of zero.
count_buffer does the obvious thing.
Sourcepub fn feed(&mut self, chord: KeyChord, now: Duration) -> Step
pub fn feed(&mut self, chord: KeyChord, now: Duration) -> Step
Feed one chord. The now argument is the current wall-clock
duration since some fixed epoch (the engine never reads the
clock itself; the host owns timekeeping).
Sourcepub fn tick(&mut self, now: Duration) -> Option<PageAction>
pub fn tick(&mut self, now: Duration) -> Option<PageAction>
Tick — fire the longest-prefix action when the ambiguity
timeout has elapsed. Returns Some(action) if an action
fired; the engine is reset.
Sourcepub fn feed_edit_mode_key(&mut self, chord: KeyChord) -> EditModeStep
pub fn feed_edit_mode_key(&mut self, chord: KeyChord) -> EditModeStep
Insert-mode key path. Returns a stub today — once
hjkl_engine::Host lands upstream this routes through
hjkl_editor::Editor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more