DropdownDelegate

Trait DropdownDelegate 

Source
pub trait DropdownDelegate: Sized {
    type Item: DropdownItem;

    // Required methods
    fn items_count(&self, section: usize) -> usize;
    fn item(&self, ix: IndexPath) -> Option<&Self::Item>;
    fn position<V>(&self, _value: &V) -> Option<IndexPath>
       where Self::Item: DropdownItem<Value = V>,
             V: PartialEq;

    // Provided methods
    fn sections_count(&self, _: &App) -> usize { ... }
    fn section(&self, _section: usize) -> Option<AnyElement> { ... }
    fn searchable(&self) -> bool { ... }
    fn perform_search(
        &mut self,
        _query: &str,
        _window: &mut Window,
        _: &mut App,
    ) -> Task<()> { ... }
}

Required Associated Types§

Required Methods§

Source

fn items_count(&self, section: usize) -> usize

Returns the number of items in the given section.

Source

fn item(&self, ix: IndexPath) -> Option<&Self::Item>

Returns the item at the given index path (Only section, row will be use).

Source

fn position<V>(&self, _value: &V) -> Option<IndexPath>
where Self::Item: DropdownItem<Value = V>, V: PartialEq,

Returns the index of the item with the given value, or None if not found.

Provided Methods§

Source

fn sections_count(&self, _: &App) -> usize

Returns the number of sections in the dropdown.

Source

fn section(&self, _section: usize) -> Option<AnyElement>

Returns the section header element for the given section index.

Source

fn searchable(&self) -> bool

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<T: DropdownItem> DropdownDelegate for Vec<T>

Source§

type Item = T

Source§

fn items_count(&self, _: usize) -> usize

Source§

fn item(&self, ix: IndexPath) -> Option<&Self::Item>

Source§

fn position<V>(&self, value: &V) -> Option<IndexPath>
where Self::Item: DropdownItem<Value = V>, V: PartialEq,

Implementors§