pub trait SearchableListItem: Clone {
type Value: Clone + PartialEq;
// Required methods
fn title(&self) -> SharedString;
fn value(&self) -> &Self::Value;
// Provided methods
fn display_title(&self) -> Option<AnyElement> { ... }
fn render(&self, _: &mut Window, _: &mut App) -> impl IntoElement { ... }
fn matches(&self, query: &str) -> bool { ... }
fn disabled(&self) -> bool { ... }
}Expand description
An item that can appear in a searchable list (Select, ComboBox).
Required Associated Types§
Required Methods§
Sourcefn title(&self) -> SharedString
fn title(&self) -> SharedString
Short display label shown in the dropdown row and in the trigger by default.
This is also what assistive technology reads as the committed value, so
it has to stand on its own as text even when Self::display_title
draws something richer.
Provided Methods§
Sourcefn display_title(&self) -> Option<AnyElement>
fn display_title(&self) -> Option<AnyElement>
Override the trigger display element (e.g. “Country (US)” instead of just “United States”).
Returns None to fall back to title().
This is presentation only. An element is not text, so the accessible
value keeps reporting Self::title; if the two would read
differently, put the meaning a listener needs in title().
Sourcefn render(&self, _: &mut Window, _: &mut App) -> impl IntoElement
fn render(&self, _: &mut Window, _: &mut App) -> impl IntoElement
Render this item’s row content inside the dropdown.
Override to add icons, avatars, secondary text, etc.
The default renders title().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".