Skip to main content

KeyBindingStore

Struct KeyBindingStore 

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

Global key table store with tmux-style default snapshots.

Implementations§

Source§

impl KeyBindingStore

Source

pub fn new() -> Self

Creates an empty key store with no tables.

Source

pub fn with_defaults() -> Result<Self, CommandParseError>

Creates a store populated with the frozen tmux default bindings.

Source

pub fn table(&self, name: &str) -> Option<&KeyBindingTable>

Returns the named table, when present.

Source

pub fn tables(&self) -> impl Iterator<Item = &KeyBindingTable>

Iterates every table in name order.

Source

pub fn get_table( &mut self, name: &str, create: bool, ) -> Option<KeyBindingTableRef>

Finds or creates a table and increments its reference count.

Source

pub fn unref_table(&mut self, name: &str)

Drops one reference from a table and removes it if it is fully empty.

Source

pub fn add_binding( &mut self, table_name: &str, key: KeyCode, note: Option<String>, repeat: bool, commands: Option<ParsedCommands>, ) -> bool

Adds or updates a binding in a table.

Source

pub fn remove_binding(&mut self, table_name: &str, key: KeyCode) -> bool

Removes one active binding from a table.

Source

pub fn reset_binding(&mut self, table_name: &str, key: KeyCode)

Restores one active binding from the default snapshot.

Source

pub fn remove_table(&mut self, table_name: &str) -> bool

Removes every binding from a table.

Source

pub fn reset_table(&mut self, table_name: &str)

Restores every binding in a table from the default snapshot.

Source

pub fn get_binding(&self, table_name: &str, key: KeyCode) -> Option<&KeyBinding>

Returns a binding from the active tree.

Source

pub fn get_default_binding( &self, table_name: &str, key: KeyCode, ) -> Option<&KeyBinding>

Returns a binding from the default snapshot.

Source

pub fn list_bindings( &self, table_name: Option<&str>, sort_order: KeyBindingSortOrder, reversed: bool, ) -> Vec<KeyBindingDisplay>

Returns every binding as display rows sorted for list-keys.

Source

pub fn has_repeat(bindings: &[KeyBindingDisplay]) -> bool

Returns whether any listed binding repeats.

Source

pub fn key_string_width(bindings: &[KeyBindingDisplay]) -> usize

Returns the maximum display width for listed key strings.

Source

pub fn key_table_width(bindings: &[KeyBindingDisplay]) -> usize

Returns the maximum display width for listed table names.

Trait Implementations§

Source§

impl Clone for KeyBindingStore

Source§

fn clone(&self) -> KeyBindingStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyBindingStore

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for KeyBindingStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for KeyBindingStore

Source§

fn eq(&self, other: &KeyBindingStore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for KeyBindingStore

Source§

impl StructuralPartialEq for KeyBindingStore

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.