Expand description
Rust SDK for s2.dev.
The Rust SDK provides ergonomic wrappers and utilities to interact with the S2 API.
§Getting started
-
Ensure you have added tokio and futures as dependencies.
cargo add tokio --features full cargo add futures -
Add the
s2-sdkdependency to your project:cargo add s2-sdk -
Generate an access token by logging into the web console at s2.dev.
-
Perform an operation.
use s2_sdk::{ S2, types::{ListBasinsInput, S2Config}, }; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let s2 = S2::new(S2Config::new("<YOUR_ACCESS_TOKEN>"))?; let page = s2.list_basins(ListBasinsInput::new()).await?; println!("My basins: {:?}", page.values); Ok(()) }
See S2 for account-level operations, S2Basin for basin-level operations,
and S2Stream for stream-level operations.
§Examples
We have curated a bunch of examples in the SDK repository demonstrating how to use the SDK effectively:
- List all basins
- Explicit stream trimming
- Producer
- Consumer
- and many more…
This documentation is generated using
rustdoc-scrape-examples,
so you will be able to see snippets from examples right here in the
documentation.
§Feedback
We use Github Issues to track feature requests and issues with the SDK. If you wish to provide feedback, report a bug or request a feature, feel free to open a Github issue.
§Quick Links
Modules§
- append_
session - Append session for pipelining multiple appends with backpressure control.
- batching
- Utilities for batching AppendRecords.
- producer
- High-level producer for appending records to streams.
- types
- Types relevant to
S2,S2Basin, andS2Stream.