SelectDelegate

Trait SelectDelegate 

Source
pub trait SelectDelegate: Sized {
    type Item: SelectItem;

    // 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: SelectItem<Value = V>,
             V: PartialEq;

    // Provided methods
    fn sections_count(&self, _: &App) -> usize { ... }
    fn section(&self, _section: usize) -> Option<AnyElement> { ... }
    fn perform_search(
        &mut self,
        _query: &str,
        _window: &mut Window,
        _: &mut Context<'_, SelectState<Self>>,
    ) -> 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: SelectItem<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 Select.

Source

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

Returns the section header element for the given section index.

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: SelectItem> SelectDelegate 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: SelectItem<Value = V>, V: PartialEq,

Implementors§