s2/
lib.rs

1/*!
2Rust SDK for S2.
3
4The Rust SDK provides ergonomic wrappers and utilities to interact with the
5[S2 API](https://s2.dev/docs/interface/grpc).
6
7# Getting started
8
91. Ensure you have `tokio` added as a dependency. The SDK relies on [Tokio](https://crates.io/crates/tokio)
10   for executing async code.
11
12   ```bash
13   cargo add tokio --features full
14   ```
15
161. Add the `streamstore` dependency to your project:
17
18   ```bash
19   cargo add streamstore
20   ```
21
221. Generate an authentication token by logging onto the web console at [s2.dev](https://s2.dev/dashboard).
23
241. Make a request using SDK client.
25
26   ```no_run
27   # let _ = async move {
28   let config = s2::ClientConfig::new("<YOUR AUTH TOKEN>");
29   let client = s2::Client::new(config);
30
31   let basins = client.list_basins(Default::default()).await?;
32   println!("My basins: {:?}", basins);
33   # return Ok::<(), s2::client::ClientError>(()); };
34   ```
35
36See documentation for the [`client`] module for more information on how to
37use the client, and what requests can be made.
38
39# Examples
40
41We have curated a bunch of examples in the
42[SDK repository](https://github.com/s2-streamstore/s2-sdk-rust/tree/main/examples)
43demonstrating how to use the SDK effectively:
44
45* [List all basins](https://github.com/s2-streamstore/s2-sdk-rust/blob/main/examples/list_all_basins.rs)
46* [Explicit stream trimming](https://github.com/s2-streamstore/s2-sdk-rust/blob/main/examples/explicit_trim.rs)
47* [Producer (with concurrency control)](https://github.com/s2-streamstore/s2-sdk-rust/blob/main/examples/producer.rs)
48* [Consumer](https://github.com/s2-streamstore/s2-sdk-rust/blob/main/examples/consumer.rs)
49* and many more...
50
51This documentation is generated using
52[`rustdoc-scrape-examples`](https://doc.rust-lang.org/rustdoc/scraped-examples.html),
53so you will be able to see snippets from examples right here in the
54documentation.
55
56# Feedback
57
58We use [Github Issues](https://github.com/s2-streamstore/s2-sdk-rust/issues)
59to track feature requests and issues with the SDK. If you wish to provide
60feedback, report a bug or request a feature, feel free to open a Github
61issue.
62
63# Quick Links
64
65* [S2 Website](https://s2.dev)
66* [S2 Documentation](https://s2.dev/docs)
67* [CHANGELOG](https://github.com/s2-streamstore/s2-sdk-rust/blob/main/CHANGELOG.md)
68*/
69
70#![doc(
71    html_favicon_url = "https://raw.githubusercontent.com/s2-streamstore/s2-sdk-rust/main/assets/s2-black.png"
72)]
73#![doc(
74    html_logo_url = "https://raw.githubusercontent.com/s2-streamstore/s2-sdk-rust/main/assets/s2-black.png"
75)]
76#![warn(missing_docs)]
77
78#[rustfmt::skip]
79mod api;
80
81mod append_session;
82mod service;
83
84pub mod batching;
85pub mod client;
86pub mod types;
87
88pub use client::{BasinClient, Client, ClientConfig, StreamClient};
89pub use service::Streaming;