pub trait SearchableItem: Item + EventEmitter<SearchEvent> {
    type Match: Any + Sync + Send + Clone;

    // Required methods
    fn clear_matches(&mut self, cx: &mut ViewContext<'_, Self>);
    fn update_matches(
        &mut self,
        matches: Vec<Self::Match>,
        cx: &mut ViewContext<'_, Self>
    );
    fn query_suggestion(&mut self, cx: &mut ViewContext<'_, Self>) -> String;
    fn activate_match(
        &mut self,
        index: usize,
        matches: Vec<Self::Match>,
        cx: &mut ViewContext<'_, Self>
    );
    fn select_matches(
        &mut self,
        matches: Vec<Self::Match>,
        cx: &mut ViewContext<'_, Self>
    );
    fn replace(
        &mut self,
        _: &Self::Match,
        _: &SearchQuery,
        _: &mut ViewContext<'_, Self>
    );
    fn find_matches(
        &mut self,
        query: Arc<SearchQuery>,
        cx: &mut ViewContext<'_, Self>
    ) -> Task<Vec<Self::Match>>;
    fn active_match_index(
        &mut self,
        matches: Vec<Self::Match>,
        cx: &mut ViewContext<'_, Self>
    ) -> Option<usize>;

    // Provided methods
    fn supported_options() -> SearchOptions { ... }
    fn match_index_for_direction(
        &mut self,
        matches: &Vec<Self::Match>,
        current_index: usize,
        direction: Direction,
        count: usize,
        _: &mut ViewContext<'_, Self>
    ) -> usize { ... }
}

Required Associated Types§

Required Methods§

source

fn clear_matches(&mut self, cx: &mut ViewContext<'_, Self>)

source

fn update_matches( &mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<'_, Self> )

source

fn query_suggestion(&mut self, cx: &mut ViewContext<'_, Self>) -> String

source

fn activate_match( &mut self, index: usize, matches: Vec<Self::Match>, cx: &mut ViewContext<'_, Self> )

source

fn select_matches( &mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<'_, Self> )

source

fn replace( &mut self, _: &Self::Match, _: &SearchQuery, _: &mut ViewContext<'_, Self> )

source

fn find_matches( &mut self, query: Arc<SearchQuery>, cx: &mut ViewContext<'_, Self> ) -> Task<Vec<Self::Match>>

source

fn active_match_index( &mut self, matches: Vec<Self::Match>, cx: &mut ViewContext<'_, Self> ) -> Option<usize>

Provided Methods§

source

fn supported_options() -> SearchOptions

source

fn match_index_for_direction( &mut self, matches: &Vec<Self::Match>, current_index: usize, direction: Direction, count: usize, _: &mut ViewContext<'_, Self> ) -> usize

Implementors§