pub struct Command {
pub id: String,
pub label: String,
pub category: String,
pub keys: Vec<Key>,
pub context: Option<String>,
pub sequence: bool,
pub unavailable: Option<String>,
}Expand description
Something the Palette offers: a binding of the keymap
(from_binding) or a command of yours.
Fields§
§id: StringWhat identifies it: context.action for a binding.
label: StringWhat it does, for people.
category: StringThe group it is listed under: a binding’s context.
keys: Vec<Key>The keys that run it, shown as its shortcut; the first runs it
under Overlays when it has no handler.
context: Option<String>The context it belongs to: listed only while that context is
active (Palette::contexts). None: always listed.
sequence: boolIts keys are pressed one after another (g g), not alternatives.
Why it cannot run now: listed greyed with the reason, and Enter or a click on it does nothing.
Implementations§
Source§impl Command
impl Command
pub fn new(id: impl Into<String>, label: impl Into<String>) -> Command
pub fn category(self, category: impl Into<String>) -> Self
Sourcepub fn keys(self, keys: impl IntoIterator<Item = Key>) -> Self
pub fn keys(self, keys: impl IntoIterator<Item = Key>) -> Self
Its shortcut, when the keymap does not say (see
Palette::hints).
List it greyed, saying reason, and do not run it.
Sourcepub fn from_binding(binding: &Binding) -> Command
pub fn from_binding(binding: &Binding) -> Command
The command a binding makes: its description, under its context, with its keys.
Sourcepub fn keys_label(&self) -> String
pub fn keys_label(&self) -> String
The keys as a hint shows them: ↑/ctrl+p, or g g for a
sequence.
Trait Implementations§
impl Eq for Command
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.