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