Rust
The official Rust server SDK for the Bias API. It is async-first (Tokio), with typed models, builder-based request parameters, cursor pagination, and idiomatic Result-based error handling. The crate is generated from the Bias OpenAPI specification.
Installation
Requires Rust 1.90 or later.
Usage
Construct a Client with your API key. Resources are accessed through methods on the client, and request parameters use a builder.
Pagination
List methods return a single page. Call items() on the page to access the rows, and read has_more to check for further pages.
To walk every page automatically, use list_paginate, which returns a Paginator. Its items() method yields a Stream over every row across all pages, fetching subsequent pages with the cursor as you consume it.
Streaming events
The events resource can stream events over a long-lived connection. list_stream forces stream=true and returns a Stream of events; heartbeats sent to keep the connection alive are skipped automatically.
See the event streaming guide for more.
Error handling
API errors surface as Err(bias::Error::Api(_)); transport and deserialization failures are their own variants. Match on the error to handle specific cases.
Cargo features
| Feature | Default | Description |
|---|---|---|
rustls-tls | ✓ | TLS via rustls. |
native-tls | TLS via the platform’s native stack. | |
blocking | Enable the blocking reqwest backend. | |
time | Expose chrono-free OffsetDateTime accessors for millisecond timestamps. |
For example, to use the platform’s native TLS stack instead of rustls: