Skip to main content

SearchSource

Trait SearchSource 

pub trait SearchSource: Widget {
    // Provided methods
    fn search_providers(&self) -> Vec<Box<dyn SearchProvider>> { ... }
    fn search_provider_descriptors(&self) -> Vec<SearchProviderDescriptor> { ... }
    fn search_index_state(&self) -> Option<IndexState> { ... }
    fn search_index_entries(&self) -> Vec<IndexEntry> { ... }
    fn activate_search_result(
        &mut self,
        _action_id: &str,
        _doc: &mut Edits<'_>,
        _path: &(dyn Any + 'static),
    ) { ... }
}
Expand description

A widget whose content is searchable.

Provided Methods§

fn search_providers(&self) -> Vec<Box<dyn SearchProvider>>

One SearchProvider per findable kind.

fn search_provider_descriptors(&self) -> Vec<SearchProviderDescriptor>

Who each of search_providers is, as the action directory’s witness reads them. A source whose providers are costly to make (one that builds an index to answer from) overrides this to describe them without making them: the witness is read on every frame that publishes the action surface, a search only when someone searches.

fn search_index_state(&self) -> Option<IndexState>

What this source’s entries for the system’s persistent search index are of now; None for a source that publishes none. Read every frame that publishes, so it must not build anything: search_index_entries is asked only when this changes.

fn search_index_entries(&self) -> Vec<IndexEntry>

The entries the system’s persistent search index keeps for this source: short metadata keyed by the stable resource id a hit opens, found after the app closes too.

fn activate_search_result( &mut self, _action_id: &str, _doc: &mut Edits<'_>, _path: &(dyn Any + 'static), )

Activate a hit: presentation (navigation), not a document action; mutate the model only if selecting changes shared state.

Implementors§

§

impl SearchSource for TileHost

§

impl<K> SearchSource for ModelView<K>
where K: PartialEq + 'static,