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.
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().
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".