pub struct CommandItem { /* private fields */ }Expand description
One command of a CommandPalette.
Implementations§
Source§impl CommandItem
impl CommandItem
Sourcepub fn new(key: impl Into<SharedString>, label: impl Into<SharedString>) -> Self
pub fn new(key: impl Into<SharedString>, label: impl Into<SharedString>) -> Self
A command label identified by key, which CommandPalette::on_select
reports. Keys must be unique in the palette.
Sourcepub fn group(self, group: impl Into<SharedString>) -> Self
pub fn group(self, group: impl Into<SharedString>) -> Self
The heading this command is listed under.
Sourcepub fn description(self, description: impl Into<SharedString>) -> Self
pub fn description(self, description: impl Into<SharedString>) -> Self
A secondary line drawn after the label, in the muted colour.
Sourcepub fn icon(self, icon: impl Into<SharedString>) -> Self
pub fn icon(self, icon: impl Into<SharedString>) -> Self
An icon before the label: an crate::IconName or any served SVG path.
Sourcepub fn shortcut(
self,
keys: impl IntoIterator<Item = impl Into<SharedString>>,
) -> Self
pub fn shortcut( self, keys: impl IntoIterator<Item = impl Into<SharedString>>, ) -> Self
The keys of the command’s shortcut, each drawn as one Kbd
(["⌘", "N"]). Display only.
Sourcepub fn keywords(
self,
words: impl IntoIterator<Item = impl Into<SharedString>>,
) -> Self
pub fn keywords( self, words: impl IntoIterator<Item = impl Into<SharedString>>, ) -> Self
Extra words the search matches besides the label and the group.
Sourcepub fn is_disabled(self, disabled: bool) -> Self
pub fn is_disabled(self, disabled: bool) -> Self
A disabled command is listed dimmed and cannot be highlighted or run.
Sourcepub fn key(&self) -> &SharedString
pub fn key(&self) -> &SharedString
The command’s key.
Sourcepub fn label(&self) -> &SharedString
pub fn label(&self) -> &SharedString
The command’s label.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandItem
impl RefUnwindSafe for CommandItem
impl Send for CommandItem
impl Sync for CommandItem
impl Unpin for CommandItem
impl UnsafeUnpin for CommandItem
impl UnwindSafe for CommandItem
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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