pub trait SearchProvider: Send + Sync {
// Required methods
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
max_results: usize,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn provider_name(&self) -> &'static str;
}Expand description
Trait for search providers.
Implement this trait to add support for different search engines.
§Example
ⓘ
struct MySearchProvider { /* ... */ }
#[async_trait]
impl SearchProvider for MySearchProvider {
async fn search(&self, query: &str, max_results: usize) -> Result<SearchResponse> {
// Implementation
}
fn provider_name(&self) -> &'static str {
"my-provider"
}
}Required Methods§
Sourcefn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
max_results: usize,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
max_results: usize,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
Get the provider name for logging/debugging.