InputBinding

Trait InputBinding 

Source
pub trait InputBinding {
    // Required methods
    fn matches(&self, ctx: &Context) -> bool;
    fn consume(&self, ctx: &Context) -> bool;
    fn display(&self) -> String;
    fn as_keyboard_shortcut(&self) -> Option<KeyboardShortcut>;
}
Expand description

Abstraction over different types of input bindings.

This trait allows treating static KeyboardShortcut constants and dynamic DynamicShortcut values uniformly.

Required Methods§

Source

fn matches(&self, ctx: &Context) -> bool

Check if this binding was triggered (does not consume the input).

Source

fn consume(&self, ctx: &Context) -> bool

Consume the input and return whether it was triggered.

Once consumed, the shortcut won’t trigger other handlers.

Source

fn display(&self) -> String

Get a human-readable representation of this binding.

Useful for displaying in menus or help screens. Example: “⌘S” or “Ctrl+S”

Source

fn as_keyboard_shortcut(&self) -> Option<KeyboardShortcut>

Convert to KeyboardShortcut if possible.

Implementors§