Struct Suggestion
pub struct Suggestion {
pub value: String,
pub label: String,
pub detail: Option<String>,
pub subtitle: Option<String>,
pub icon: Option<Icon>,
pub person: Option<SuggestionPerson>,
pub role: RowRole,
pub matched: Vec<Range<usize>>,
pub aside: Option<String>,
pub checked: Option<bool>,
pub shortcut: Option<String>,
}Expand description
One completion offered in the dropdown.
Fields§
§value: StringThe text inserted into the field when this suggestion is accepted.
label: StringThe label shown in the dropdown row. Defaults to value via
Suggestion::new.
detail: Option<String>Optional dim secondary text shown right-aligned in the row (e.g. a type or a count).
subtitle: Option<String>Optional dim line under the label (a page’s address under its title). A list with any such line gives every row two lines.
icon: Option<Icon>Optional leading glyph.
person: Option<SuggestionPerson>A participant this row names: painted as their avatar (or, for software acting in the workspace, the agent mark) in place of an icon.
role: RowRoleWhat the row is: a pickable item (the default), a group’s header or a notice (“No matches”).
matched: Vec<Range<usize>>Byte ranges of the label the typed query matched, painted bold.
aside: Option<String>Dim text right after the label on the same line: a handle, a topic, a command’s parameters.
checked: Option<bool>A state shown in a trailing check column: checked or not. A list with any such row keeps the column on every row.
shortcut: Option<String>The keys that do what the row does, at its trailing end.
Implementations§
§impl Suggestion
impl Suggestion
pub fn is_pickable(&self) -> bool
pub fn is_pickable(&self) -> bool
Whether the row can be armed and accepted.
§impl Suggestion
impl Suggestion
pub fn new(value: impl Into<String>) -> Suggestion
pub fn new(value: impl Into<String>) -> Suggestion
A suggestion whose visible label is its inserted value.
pub fn labelled(
value: impl Into<String>,
label: impl Into<String>,
) -> Suggestion
pub fn labelled( value: impl Into<String>, label: impl Into<String>, ) -> Suggestion
A suggestion whose visible label differs from the inserted value.
pub fn with_icon(self, icon: Icon) -> Suggestion
pub fn with_detail(self, detail: impl Into<String>) -> Suggestion
pub fn with_subtitle(self, subtitle: impl Into<String>) -> Suggestion
pub fn with_subtitle(self, subtitle: impl Into<String>) -> Suggestion
Show subtitle as a dim line under the label.
pub fn with_person(self, person: SuggestionPerson) -> Suggestion
pub fn with_person(self, person: SuggestionPerson) -> Suggestion
Lead the row with person’s avatar.
pub fn with_checked(self, checked: bool) -> Suggestion
pub fn with_checked(self, checked: bool) -> Suggestion
Show checked in the trailing check column.
pub fn with_shortcut(self, keys: impl Into<String>) -> Suggestion
pub fn with_shortcut(self, keys: impl Into<String>) -> Suggestion
Show the keys that do what the row does at its end.
Trait Implementations§
§impl Clone for Suggestion
impl Clone for Suggestion
§fn clone(&self) -> Suggestion
fn clone(&self) -> Suggestion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Suggestion
impl Debug for Suggestion
§impl FloatingRow for Suggestion
impl FloatingRow for Suggestion
§type Columns = CheckColumn
type Columns = CheckColumn
§fn height(&self, metrics: &FloatingMetrics) -> f64
fn height(&self, metrics: &FloatingMetrics) -> f64
metrics.§fn same(&self, other: &Suggestion) -> bool
fn same(&self, other: &Suggestion) -> bool
self and other are the same row: replacing rows with the
same ones then leaves the list scrolled where the person left it. Rows
of plain data compare; a row carrying actions always replaces.§fn paint(
&self,
ctx: &mut PaintCtx<'_>,
row: Rect,
state: RowState<'_, CheckColumn>,
) -> Option<f64>
fn paint( &self, ctx: &mut PaintCtx<'_>, row: Rect, state: RowState<'_, CheckColumn>, ) -> Option<f64>
§fn two_line(&self) -> bool
fn two_line(&self) -> bool
§fn content_width(
&self,
m: &FloatingMetrics,
role: TextRole,
text: &mut TextRenderer,
theme: &Theme,
) -> f64
fn content_width( &self, m: &FloatingMetrics, role: TextRole, text: &mut TextRenderer, theme: &Theme, ) -> f64
§fn columns(rows: &[Suggestion]) -> CheckColumn
fn columns(rows: &[Suggestion]) -> CheckColumn
rows shares.§fn cell_count(&self) -> usize
fn cell_count(&self) -> usize
§impl From<SuggestionProps> for Suggestion
impl From<SuggestionProps> for Suggestion
§fn from(props: SuggestionProps) -> Suggestion
fn from(props: SuggestionProps) -> Suggestion
§impl PartialEq for Suggestion
impl PartialEq for Suggestion
impl Eq for Suggestion
impl StructuralPartialEq for Suggestion
Auto Trait Implementations§
impl Freeze for Suggestion
impl RefUnwindSafe for Suggestion
impl Send for Suggestion
impl Sync for Suggestion
impl Unpin for Suggestion
impl UnsafeUnpin for Suggestion
impl UnwindSafe for Suggestion
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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