pub struct Command {
pub id: String,
pub label: String,
pub description: Option<String>,
pub shortcut: Option<KeyboardShortcut>,
pub icon: Option<&'static Icon>,
pub category: Option<String>,
pub keywords: Vec<String>,
}Expand description
A command that can be executed from the command palette
Fields§
§id: StringUnique identifier for this command
label: StringDisplay label shown in the palette
description: Option<String>Optional longer description
shortcut: Option<KeyboardShortcut>Optional keyboard shortcut
icon: Option<&'static Icon>Optional icon
category: Option<String>Optional category for grouping
keywords: Vec<String>Keywords for better search matching
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
Create a new command with the given ID and label
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set the command description
Sourcepub fn keywords(
self,
keywords: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn keywords( self, keywords: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add keywords for better search matching
Sourcepub fn searchable_text(&self) -> String
pub fn searchable_text(&self) -> String
Get all searchable text for this command
Trait Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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