DropdownItem

Trait DropdownItem 

Source
pub trait DropdownItem: Clone {
    type Value: Clone;

    // Required methods
    fn title(&self) -> SharedString;
    fn value(&self) -> &Self::Value;

    // Provided methods
    fn display_title(&self) -> Option<AnyElement> { ... }
    fn matches(&self, query: &str) -> bool { ... }
}
Expand description

A trait for items that can be displayed in a dropdown.

Required Associated Types§

Required Methods§

Source

fn title(&self) -> SharedString

Source

fn value(&self) -> &Self::Value

Provided Methods§

Source

fn display_title(&self) -> Option<AnyElement>

Customize the display title used to selected item in Dropdown Input.

If return None, the title will be used.

Source

fn matches(&self, query: &str) -> bool

Check if the item matches the query for search, default is to match the title.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DropdownItem for String

Source§

type Value = String

Source§

fn title(&self) -> SharedString

Source§

fn value(&self) -> &Self::Value

Source§

impl DropdownItem for SharedString

Implementors§