Skip to main content

Prerequisites

Before installing the driver, ensure you have:
  • Rust 1.85.0 or later - Check with rustc --version
  • Cargo - Rust’s package manager (comes with Rust)
  • Tokio runtime - The driver requires an async runtime
The driver is published on crates.io as the scylla crate.

Basic Installation

Add the ScyllaDB Rust Driver to your Cargo.toml:
Cargo.toml
[dependencies]
scylla = "1.5"
tokio = { version = "1.40", features = ["full"] }
futures = "0.3"
Then run:
cargo build
The driver will be downloaded and compiled along with its dependencies.

Feature Flags

The driver provides several optional feature flags to enable additional functionality. By default, no features are enabled to keep the dependency tree minimal.

TLS Support

Choose between OpenSSL or Rustls for TLS connections:
[dependencies]
scylla = { version = "1.5", features = ["openssl-010"] }
tokio-openssl = "0.6"
openssl = "0.10"
Use Rustls for pure-Rust TLS implementation, or OpenSSL if you need compatibility with system OpenSSL libraries.

Date and Time Types

Enable support for external date/time libraries:
[dependencies]
scylla = { version = "1.5", features = ["chrono-04"] }
chrono = "0.4"

Numeric Types

Add support for arbitrary precision numbers:
[dependencies]
scylla = { version = "1.5", features = ["num-bigint-04"] }
num-bigint = "0.4"

Secret Management

Integrate with the secrecy crate for secure handling of sensitive data:
Cargo.toml
[dependencies]
scylla = { version = "1.5", features = ["secrecy-08"] }
secrecy = "0.8"

Metrics Collection

Enable driver-side metrics for monitoring:
Cargo.toml
[dependencies]
scylla = { version = "1.5", features = ["metrics"] }
This enables access to latency histograms, error counters, and other performance metrics:
let metrics = session.get_metrics();
println!("Queries requested: {}", metrics.get_queries_num());
println!("Average latency: {}ms", metrics.get_latency_avg_ms()?);
println!("99.9 percentile: {}ms", metrics.get_latency_percentile_ms(99.9)?);

Full Serialization

Enable all serialization features at once:
Cargo.toml
[dependencies]
scylla = { version = "1.5", features = ["full-serialization"] }
This is equivalent to enabling:
  • chrono-04
  • time-03
  • secrecy-08
  • secrecy-10
  • num-bigint-03
  • num-bigint-04
  • bigdecimal-04
Using full-serialization will increase compile times and binary size. Only enable the features you actually need.

Complete Example Configuration

Here’s a complete Cargo.toml with commonly used features:
Cargo.toml
[package]
name = "my-scylla-app"
version = "0.1.0"
edition = "2024"
rust-version = "1.85"

[dependencies]
# ScyllaDB Driver with TLS and metrics
scylla = { version = "1.5", features = [
    "rustls-023",
    "chrono-04",
    "metrics",
] }

# Async runtime
tokio = { version = "1.40", features = [
    "macros",
    "rt-multi-thread",
    "time",
] }

# Async utilities
futures = "0.3"

# Date/time
chrono = "0.4"

# Error handling
anyhow = "1.0"

# TLS
tokio-rustls = "0.26"
rustls = "0.23"

Verifying Installation

Create a simple test file to verify the installation:
src/main.rs
use scylla::client::session_builder::SessionBuilder;

#[tokio::main]
async fn main() {
    println!("ScyllaDB Rust Driver version: {}", env!("CARGO_PKG_VERSION"));

    // This will fail if no ScyllaDB instance is running, but proves the driver compiles
    match SessionBuilder::new().known_node("127.0.0.1:9042").build().await {
        Ok(_) => println!("Successfully connected to ScyllaDB!"),
        Err(e) => println!("Connection failed (expected if no server running): {}", e),
    }
}
Run with:
cargo run
1

Add dependency

Add scylla to your Cargo.toml with desired features
2

Build project

Run cargo build to download and compile dependencies
3

Verify installation

Create a simple test file and run cargo run
4

Start building

You’re ready to build your application!

Unstable Features

The driver includes several unstable features that are subject to change. These should only be used if you understand the risks.
Unstable features include:
  • unstable-testing - Testing utilities
  • unstable-cpp-rs - CPP-RS Driver compatibility
  • unstable-nodejs-rs - Node.js-RS Driver compatibility
  • unstable-host-listener - Host event listener support
  • unstable-reconnect-policy - Reconnection policy configuration
These features are not covered by the stability guarantees and may have breaking changes in minor releases.

Next Steps

Quickstart

Build your first application with the driver

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love