Skip to main content

CommandEntry

Struct CommandEntry 

pub struct CommandEntry {
Show 21 fields pub id: String, pub label: String, pub description: Option<String>, pub badge: Option<String>, pub keybinding: Option<String>, pub shortcut: Option<Shortcut>, pub argument: Option<ArgumentSpec>, pub group: Option<String>, pub group_total: Option<usize>, pub icon: Option<Icon>, pub image: Option<AppImage>, pub avatar: Option<(String, String)>, pub faces: Vec<RowFace>, pub outcome: Option<String>, pub section: Option<String>, pub alternates: Vec<Alternate>, pub description_is_path: bool, pub description_facts: Vec<String>, pub adjustable: bool, pub row: Option<SearchRow>, pub preview: Option<SearchPreview>,
}
Expand description

One row a host feeds the palette: what it reads as, and what choosing it needs.

Fields§

§id: String§label: String§description: Option<String>

Rendered under the label. None → label only.

§badge: Option<String>

Short status shown as a trailing pill. Unlike a keybinding it is descriptive and announced as part of the row.

§keybinding: Option<String>

Rendered right-aligned in the row. Purely informational — the palette never binds it.

§shortcut: Option<Shortcut>

Preferred semantic form of a shortcut. When present, it is rendered with the host platform’s native command modifier and notation.

§argument: Option<ArgumentSpec>

The one value choosing this row collects in the field first.

§group: Option<String>

Consecutive rows sharing a group render under one header; None joins whatever section precedes it.

§group_total: Option<usize>

Real row count for this group before any host-side cap, so a capped section reports what it’s hiding instead of the painted count.

§icon: Option<Icon>§image: Option<AppImage>

The application’s own artwork, painted in place of icon when it decodes.

§avatar: Option<(String, String)>

A person as (name, key): their avatar in place of icon, its initials from the name and its colour from the key.

§faces: Vec<RowFace>

The people the row is about, as a stack of faces at its trailing end.

§outcome: Option<String>

What choosing the row does, shown at its trailing edge (“Join”, “Open”), for a row whose outcome is not its title.

§section: Option<String>

The section the row is in (“Happening now”), above its group: a header of its own, and a named group to assistive technology.

§alternates: Vec<Alternate>

Other ways to activate the row, each behind a held modifier. The selected row shows the one whose modifier is down, or the first as a hint; the host decides what each does.

§description_is_path: bool

The description is a path, so it loses its middle rather than its end when it doesn’t fit. Prose loses its end.

§description_facts: Vec<String>

The description as separate facts, drawn as runs of their own with space between them (Self::facts). Empty: one run.

§adjustable: bool

Its value steps with ←/→ while the row is selected and the query’s caret is at its end (ActionPalette::take_adjustment): a volume, a timeout, a mode.

§row: Option<SearchRow>

The row a hit’s app draws for it, when the host has one (Self::drawn): the palette paints that instead of the generic row. A row whose shape the palette cannot paint falls back to the generic one.

§preview: Option<SearchPreview>

What the hit looks like in its app, for the band under the list (Self::previewed).

Implementations§

§

impl CommandEntry

pub fn new(id: impl Into<String>, label: impl Into<String>) -> CommandEntry

pub fn drawn(self, row: SearchRow) -> CommandEntry

Draw the row as row, the shape its app draws it with (crate::search::SearchRow).

pub fn previewed(self, preview: SearchPreview) -> CommandEntry

Show preview under the list while the row is selected.

pub fn adjustable(self) -> CommandEntry

Let ←/→ step the row’s value (Self::adjustable).

pub fn alternate( self, modifier: ActivationModifier, label: impl Into<String>, ) -> CommandEntry

Offer another activation behind modifier (Alternate).

pub fn facts(self, facts: Vec<String>) -> CommandEntry

Show the description as separate facts (Self::description_facts).

pub fn path_description(self) -> CommandEntry

Mark the description as a path (Self::description_is_path).

pub fn description(self, d: impl Into<String>) -> CommandEntry

pub fn badge(self, badge: impl Into<String>) -> CommandEntry

pub fn group(self, g: impl Into<String>) -> CommandEntry

pub fn group_total(self, total: usize) -> CommandEntry

pub fn icon(self, icon: Icon) -> CommandEntry

pub fn image(self, image: AppImage) -> CommandEntry

pub fn avatar( self, name: impl Into<String>, key: impl Into<String>, ) -> CommandEntry

Show the row as a person (Self::avatar).

pub fn faces(self, faces: Vec<RowFace>) -> CommandEntry

Show the people the row is about as faces at its end (Self::faces).

pub fn outcome(self, outcome: impl Into<String>) -> CommandEntry

What choosing the row does, at its trailing edge.

pub fn in_section(self, section: impl Into<String>) -> CommandEntry

Put the row in section section (Self::section).

pub fn from_flat_action_shown( fa: &FlatAction<'_>, row: ListedRow, ) -> CommandEntry

The row for one exported action of a resource, read as row says (tilo_actions::listed_row): the title a person reads, what it acts on or means under it, the action’s own picture, and the shortcut it declared. Every surface listing an action builds its row here, so the window’s own search and the desktop’s palette show the same thing.

pub fn from_flat_action(fa: &FlatAction<'_>) -> CommandEntry

The row for one exported action of a resource, as inert data: its label, and what it acts on or means under it (tilo_actions::listed_row), never “Feeds — New folder”.

pub fn from_descriptor( key: impl Into<String>, action: &ActionDescriptor, ) -> CommandEntry

The row for one published action, as inert data: its label, what it says of itself, the state it shows and the one line it asks for. The host runs it by the action’s own address when it is chosen.

pub fn keybinding(self, k: impl Into<String>) -> CommandEntry

pub fn shortcut(self, shortcut: Shortcut) -> CommandEntry

Adds a platform-formatted shortcut hint. Prefer this to Self::keybinding for commands using the native command modifier.

pub fn with_argument( self, prompt: impl Into<String>, placeholder: impl Into<String>, ) -> CommandEntry

Collect prompt’s value before choosing the row.

pub fn with_argument_prefill(self, prefill: impl Into<String>) -> CommandEntry

Prefill is fully selected when the argument step opens, so the first keystroke replaces it.

pub fn with_preset(self) -> CommandEntry

The row already carries the value it runs with, so choosing it asks for none: a search hit an app’s open names its item itself.

pub fn keybinding_label(&self, platform: PlatformConventions) -> Option<String>

The row’s shortcut in platform’s notation, else its free-text keybinding.

Trait Implementations§

§

impl Clone for CommandEntry

§

fn clone(&self) -> CommandEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for CommandEntry

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> CommonTraits for T
where T: AsAny + Any + Debug + WasmNotSendSync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,