Expand description
§Search SDK - Rust Implementation
A high-performance Rust SDK for integrating with multiple web search providers through a single, consistent interface.
Initially based on the PlustOrg/search-sdk TypeScript library, this Rust implementation has evolved to include additional features such as multi-provider search strategies, load balancing, failover support, and performance monitoring.
§Quick Start
use websearch::{web_search, providers::google::GoogleProvider, SearchOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Configure the Google search provider
let google = GoogleProvider::new("YOUR_API_KEY", "YOUR_SEARCH_ENGINE_ID")?;
// Perform a search
let results = web_search(SearchOptions {
query: "Rust programming language".to_string(),
max_results: Some(5),
provider: Box::new(google),
..Default::default()
}).await?;
for result in results {
println!("{}: {}", result.title, result.url);
}
Ok(())
}Re-exports§
pub use error::SearchError;pub use error::SearchResult as Result;pub use types::DebugOptions;pub use types::SearchOptions;pub use types::SearchProvider;pub use types::SearchResult;
Modules§
- error
- Error types for the search SDK
- multi_
provider - Multi-provider search functionality with load balancing and failover
- providers
- Search provider implementations
- types
- Core types and traits for the search SDK
- utils
- Utility modules for the search SDK
Functions§
- web_
search - Main search function that queries a web search provider and returns standardized results