Skip to main content

LanguageBackend

Trait LanguageBackend 

Source
pub trait LanguageBackend: Send + Sync {
    // Required methods
    fn mode(&self) -> LangMode;
    fn build_candidate_keys(
        &self,
        text: &str,
        budget: KeyBudget,
    ) -> Vec<SearchKey>;
    fn expand_query(
        &self,
        query: &str,
        budget: QueryBudget,
    ) -> Vec<QueryVariant>;

    // Provided method
    fn normalize_candidate(&self, text: &str) -> String { ... }
}
Expand description

Language-specific candidate and query expansion.

Required Methods§

Source

fn mode(&self) -> LangMode

Returns the language mode implemented by this backend.

Source

fn build_candidate_keys(&self, text: &str, budget: KeyBudget) -> Vec<SearchKey>

Builds additional language-specific search keys for candidate text.

Source

fn expand_query(&self, query: &str, budget: QueryBudget) -> Vec<QueryVariant>

Expands a user query into language-specific query variants.

Provided Methods§

Source

fn normalize_candidate(&self, text: &str) -> String

Normalizes candidate display text before the base normalized key is added.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§