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: boolThe 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: boolIts 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
impl CommandEntry
pub fn new(id: impl Into<String>, label: impl Into<String>) -> CommandEntry
pub fn drawn(self, row: SearchRow) -> 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
pub fn previewed(self, preview: SearchPreview) -> CommandEntry
Show preview under the list while the row is selected.
pub fn adjustable(self) -> CommandEntry
pub fn adjustable(self) -> CommandEntry
Let ←/→ step the row’s value (Self::adjustable).
pub fn alternate(
self,
modifier: ActivationModifier,
label: impl Into<String>,
) -> CommandEntry
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
pub fn facts(self, facts: Vec<String>) -> CommandEntry
Show the description as separate facts (Self::description_facts).
pub fn path_description(self) -> CommandEntry
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
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
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
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
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
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
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
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
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
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
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
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>
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
impl Clone for CommandEntry
§fn clone(&self) -> CommandEntry
fn clone(&self) -> CommandEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CommandEntry
impl !RefUnwindSafe for CommandEntry
impl Send for CommandEntry
impl Sync for CommandEntry
impl Unpin for CommandEntry
impl UnsafeUnpin for CommandEntry
impl !UnwindSafe for CommandEntry
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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 Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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