Crate s2_sdk

Crate s2_sdk 

Source
Expand description

Rust SDK for s2.dev.

The Rust SDK provides ergonomic wrappers and utilities to interact with the S2 API.

§Getting started

  1. Ensure you have added tokio and futures as dependencies.

    cargo add tokio --features full
    cargo add futures
  2. Add the s2-sdk dependency to your project:

    cargo add s2-sdk
  3. Generate an access token by logging into the web console at s2.dev.

  4. 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:

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.

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, and S2Stream.

Structs§

S2
An S2 account.
S2Basin
A basin in an S2 account.
S2Stream
A stream in an S2 basin.