Skip to main content

Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }
Expand description

Page-mode dispatcher.

Implementations§

Source§

impl Engine

Source

pub fn new(keymap: Keymap) -> Self

Source

pub fn with_timeout(keymap: Keymap, timeout: Duration) -> Self

Source

pub fn keymap(&self) -> &Keymap

Source

pub fn keymap_mut(&mut self) -> &mut Keymap

Source

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.

Source

pub fn mode(&self) -> PageMode

Source

pub fn set_mode(&mut self, mode: PageMode)

Force the mode. Resets the pending buffer.

Source

pub fn pending(&self) -> &[KeyChord]

Current pending chord buffer (for status-line rendering).

Source

pub fn register(&self) -> Option<char>

Currently captured register, if any.

Source

pub fn count(&self) -> u32

Currently buffered count (0 = none).

Source

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::countcount 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.

Source

pub fn timeout(&self) -> Duration

Configured ambiguity timeout.

Source

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

Source

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.

Source

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§

Source§

impl Debug for Engine

Source§

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

Formats the value using the given formatter. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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