13 unstable releases (6 breaking)

new 0.7.0 Nov 14, 2024
0.5.2 Aug 22, 2024
0.5.1 Jul 11, 2024
0.4.0 Feb 2, 2024
0.1.0 Apr 7, 2021

#2774 in Database interfaces

Download history 26640/week @ 2024-07-29 30632/week @ 2024-08-05 29621/week @ 2024-08-12 28708/week @ 2024-08-19 39596/week @ 2024-08-26 32220/week @ 2024-09-02 34191/week @ 2024-09-09 32082/week @ 2024-09-16 35542/week @ 2024-09-23 39007/week @ 2024-09-30 27852/week @ 2024-10-07 42119/week @ 2024-10-14 36630/week @ 2024-10-21 28422/week @ 2024-10-28 26447/week @ 2024-11-04 49008/week @ 2024-11-11

141,423 downloads per month
Used in 45 crates (2 directly)

MIT/Apache

135KB
2.5K SLoC

ScyllaDB Rust Driver

Crates.io docs.rs minimum rustc version

This is a client-side driver for ScyllaDB written in pure Rust with a fully async API using Tokio. Although optimized for ScyllaDB, the driver is also compatible with Apache Cassandra®.

Note: this driver is officially supported but currently available in beta. Bug reports and pull requests are welcome!

Getting Started

The documentation book is a good place to get started. Another useful resource is the Rust and Scylla lesson on Scylla University.

Examples

use futures::TryStreamExt;

let uri = "127.0.0.1:9042";

let session: Session = SessionBuilder::new().known_node(uri).build().await?;

let query_pager = session.query_iter("SELECT a, b, c FROM ks.t", &[]).await?;
let mut stream = query_pager.rows_stream::<(i32, i32, String)>()?;
while let Some((a, b, c)) = stream.try_next().await? {
    println!("a, b, c: {}, {}, {}", a, b, c);
}

Please see the full example program for more information. You can also run the example as follows if you have a Scylla server running:

SCYLLA_URI="127.0.0.1:9042" cargo run --example basic

All examples are available in the examples directory

Features and Roadmap

The driver supports the following:

  • Asynchronous API
  • Token-aware routing
  • Shard-aware routing (specific to ScyllaDB)
  • Prepared statements
  • Query paging
  • Compression (LZ4 and Snappy algorithms)
  • CQL binary protocol version 4
  • Batch statements
  • Configurable load balancing policies
  • Driver-side metrics
  • TLS support - install openssl if you want to use it https://docs.rs/openssl/0.10.32/openssl/#automatic
  • Configurable retry policies
  • Authentication support
  • CQL tracing

Ongoing efforts:

  • CQL Events
  • More tests
  • More benchmarks

Getting Help

Please join the #rust-driver channel on ScyllaDB Slack to discuss any issues or questions you might have.

Supported Rust Versions

Our driver's minimum supported Rust version (MSRV) is 1.70.0. Any changes:

  • Will be announced in release notes.
  • Before 1.0 will only happen in major releases.
  • After 1.0 will also happen in minor, but not patch releases.

Exact MSRV policy after 1.0 is not yet decided.

Reference Documentation

Other Drivers

License

This project is licensed under either of

at your option.

Dependencies

~0.6–1MB
~23K SLoC