# searchSDK for Rust

Rust / Cargo 1.98+. 14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

Canonical: https://searchsdk.dev/docs/sdks/rust
Markdown: https://searchsdk.dev/docs/sdks/rust.md

<a id="install"></a>

## Install from source

Package: `searchsdk`, version `0.1.0-alpha.1`. This is an alpha source/local-artifact installation. No public registry release or release tag is assumed.

**Get the source**

```bash
git clone https://github.com/Belweave/searchSDK.git
cd searchSDK
# Record this revision with your application's dependency lock.
git rev-parse HEAD
```

**Application dependency configuration**

```toml
[dependencies]
searchsdk = { path = "/absolute/path/searchSDK/packages/rust" }
tokio = { version = "=1.53.1", features = ["rt", "macros"] }
```

Add these entries to your application's Cargo.toml. This uses the source checkout, not a crates.io release. The SDK uses Tokio, Reqwest with rustls, and Serde; retain Cargo.lock.

<a id="first-search"></a>

## Make a server-side search

Set provider keys in your application's server environment or secret store. The example below makes a real provider request when invoked and can incur charges. Use the package's fixture consumer for a key-free check.

**src/main.rs**

```rust
use searchsdk::{Provider, ProviderId, SearchClient, SearchRequest, CallOptions};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let key = std::env::var("EXA_API_KEY")?;
    let search = SearchClient::new(Provider::new(ProviderId::Exa, key)?)?;
    let response = search.search(
        SearchRequest::new("SQLite write concurrency"),
        CallOptions::default(),
    ).await?;
    for result in response.results {
        println!("{}", result.url);
    }
    Ok(())
}
```

Set EXA_API_KEY on the server, then cargo run. This request uses the default result limit of five; no network request runs during compilation.

<a id="scope"></a>

## Supported surface and limits

14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

- Native schema models preserve provider fields but are not an exhaustive runtime JSON Schema validator.
- Keep provider execution on servers; a Cargo build does not establish mobile, browser or WebAssembly support.

Preserve result order, provider-native scores and source provenance. Unknown usage is not zero cost. Cancellation and deadlines cannot undo a request already accepted by a remote system or guarantee exactly-once effects.

<a id="verify"></a>

## Verify without provider keys

**Repository checkout · local checks**

```bash
cargo test --manifest-path packages/rust/Cargo.toml --locked -j 2
cargo clippy --manifest-path packages/rust/Cargo.toml --locked -j 2 -- -D warnings
cargo package --manifest-path packages/rust/Cargo.toml --locked
```

534 tests, formatting, Clippy, Cargo packaging and a consumer built from the extracted crate.

These are deterministic contract and artifact checks. They do not establish live-provider or account-entitlement verification. Read the package README for precise commands, dependencies and runtime coverage.

<a id="next"></a>

## Continue in your language

- [Rust package reference](https://github.com/Belweave/searchSDK/tree/main/packages/rust#readme): Complete API, errors, streaming, packaging and platform boundaries.
- [Compare SDKs](https://searchsdk.dev/docs/sdks)
- [Choose a provider](https://searchsdk.dev/docs/providers)
