# Rust

Detect disposable emails in Rust using an asynchronous IronDome client. Share connection pools across tasks and configure timeouts.

Check email addresses from your Rust signup flow before creating an account. Keep the API key in server configuration and reuse the async client so requests share its connection pool.

## Availability

Use the published 0.2.0 crate with a timer-enabled Tokio runtime.

## Create and reuse a client

```toml
[dependencies]
irondome-sdk = "=0.2.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
```

Set `IRONDOME_API_KEY` in the server environment. The default options use `https://api.irondome.dev`.

```rust
use irondome_sdk::{Client, Options};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new(
        &std::env::var("IRONDOME_API_KEY")?,
        Options::default(),
    )?;

    let result = client.check("person@example.com").await?;
    println!("disposable={} reason={:?}", result.disposable, result.reason);
    Ok(())
}
```

Construct the client once during application startup. Clone it for concurrent tasks; clones share the pool and concurrency limit. Drop all clones after work finishes at shutdown. Use a timer-enabled Tokio runtime.

## Results and failures

`check()` returns typed provider and reason values, `valid`, `disposable`, and optional request metadata. `valid` does not prove mailbox existence or deliverability. Errors distinguish API failures from configuration, validation, protocol, transport, timeout, and concurrency failures. Handle errors separately from classifications; a canceled or timed-out request may already have been processed.

`client.warmup().await` optionally sends a health request through the same pool without an email or API key. It can overlap independent startup work, but should not run before each check.

`client.check_bulk(&["person@example.com", "invalid"]).await?` accepts up to 100 addresses and preserves result order. See the [bulk API guide](/docs/api/bulk) and [performance guide](/docs/guides/performance).
