SelectItem

Trait SelectItem 

Source
pub trait SelectItem: 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 select.

Required Associated Types§

Required Methods§

Source

fn title(&self) -> SharedString

Source

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

Get the value of the item.

Provided Methods§

Source

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

Customize the display title used to selected item in Select 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 SelectItem for &'static str

Source§

type Value = &'static str

Source§

fn title(&self) -> SharedString

Source§

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

Source§

impl SelectItem for String

Source§

type Value = String

Source§

fn title(&self) -> SharedString

Source§

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

Source§

impl SelectItem for SharedString

Implementors§