pub struct CommandItem { /* private fields */ }Expand description
One typed command entry rendered in a CommandPalette.
Implementations§
Source§impl CommandItem
impl CommandItem
Sourcepub fn new(
id: impl Into<SharedString>,
label: impl Into<SharedString>,
) -> CommandItem
pub fn new( id: impl Into<SharedString>, label: impl Into<SharedString>, ) -> CommandItem
Creates an enabled command with a stable id and primary display label.
Sourcepub fn supporting(self, text: impl Into<SharedString>) -> CommandItem
pub fn supporting(self, text: impl Into<SharedString>) -> CommandItem
Sets optional secondary description text rendered beneath the command label.
Sourcepub fn group(self, heading: impl Into<SharedString>) -> CommandItem
pub fn group(self, heading: impl Into<SharedString>) -> CommandItem
Assigns this command to a visual group heading.
Sourcepub fn icon(self, icon: IconName) -> CommandItem
pub fn icon(self, icon: IconName) -> CommandItem
Sets an optional leading bundled Material Symbol icon.
Sourcepub fn shortcut(self, shortcut: impl Into<SharedString>) -> CommandItem
pub fn shortcut(self, shortcut: impl Into<SharedString>) -> CommandItem
Sets an optional keyboard shortcut hint badge (for example "Ctrl+K" or "⌘P").
Sourcepub fn keyword(self, keyword: impl Into<SharedString>) -> CommandItem
pub fn keyword(self, keyword: impl Into<SharedString>) -> CommandItem
Appends one extra search keyword matched by the default command filter.
Sourcepub fn keywords<I, S>(self, keywords: I) -> CommandItem
pub fn keywords<I, S>(self, keywords: I) -> CommandItem
Appends multiple extra search keywords matched by the default command filter.
Sourcepub fn disabled(self, disabled: bool) -> CommandItem
pub fn disabled(self, disabled: bool) -> CommandItem
Marks this command as unavailable (greyed out, non-clickable, skipped by keyboard navigation).
Sourcepub fn id(&self) -> &SharedString
pub fn id(&self) -> &SharedString
Returns the stable command identifier.
Sourcepub fn label(&self) -> &SharedString
pub fn label(&self) -> &SharedString
Returns the primary display label.
Sourcepub fn supporting_text(&self) -> Option<&SharedString>
pub fn supporting_text(&self) -> Option<&SharedString>
Returns the optional supporting description.
Sourcepub fn group_label(&self) -> Option<&SharedString>
pub fn group_label(&self) -> Option<&SharedString>
Returns the optional group heading assigned to this command.
Sourcepub fn shortcut_label(&self) -> Option<&SharedString>
pub fn shortcut_label(&self) -> Option<&SharedString>
Returns the optional shortcut hint string.
Sourcepub fn keywords_slice(&self) -> &[SharedString]
pub fn keywords_slice(&self) -> &[SharedString]
Returns the extra search keywords associated with this command.
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Returns true when this command is disabled.
Trait Implementations§
Source§impl Clone for CommandItem
impl Clone for CommandItem
Source§fn clone(&self) -> CommandItem
fn clone(&self) -> CommandItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandItem
impl Debug for CommandItem
impl Eq for CommandItem
Source§impl PartialEq for CommandItem
impl PartialEq for CommandItem
impl StructuralPartialEq for CommandItem
Auto Trait Implementations§
impl Forget for CommandItem
impl Freeze for CommandItemwhere
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<SharedString>: Freeze,
impl Move for CommandItem
impl RefUnwindSafe for CommandItem
impl Send for CommandItem
impl Sync for CommandItem
impl Unpin for CommandItem
impl UnsafeUnpin for CommandItemwhere
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<SharedString>: UnsafeUnpin,
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
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<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.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> ⓘ
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> ⓘ
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