Install the Aerospike Rust client
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
Versions
-
The stable release of the Rust client is version 2.2.0.
-
As of version 2.1.0, the Aerospike Rust client is fully supported for production use.
Prerequisites
-
Rust at or above the minimum version for your target client version:
Client version Minimum Rust version 2.2.0 1.87 2.1.0 1.87 1.3.0 1.46 -
A choice of async runtime for your project: Tokio or async-std.
-
An Aerospike server. See the Client matrix for client/server version compatibility.
Install
To use the client in your own project, add it with the async runtime you chose.
For Tokio, use:
cargo add tokiocargo add aerospike@2.2.0 --features rt-tokioFor async-std, use:
cargo add async-stdcargo add aerospike@2.2.0 --features rt-async-stdThe client also supports a sync feature for the older, blocking API. Use it
only if you can’t adopt async/await yet: it requires
--no-default-features because async is a default feature.
cargo add aerospike@2.2.0 --no-default-features --features rt-tokio,syncBuild from source code
-
Clone the Git repository:
git clone --single-branch --branch v3.0.0 https://github.com/aerospike/aerospike-client-rust.gitcd aerospike-client-rust -
Build the project (requires Rust 1.87 or later):
cargo build
Use as a dependency
-
To use the client in your own project, add one of the following to your
Cargo.toml:[dependencies]# Async API with Tokio runtime (default features include async, tls, and serialization)aerospike = { version = "3.0.0", features = ["rt-tokio"] }# OR# Async API with async-std runtime (disable defaults — they already include rt-tokio)aerospike = { version = "3.0.0", default-features = false, features = ["async", "rt-async-std", "serialization"] }# Blocking sync API (enable `sync` and disable default `async` — do not enable both)aerospike = { version = "3.0.0", default-features = false, features = ["rt-tokio", "sync"] }# ORaerospike = { version = "3.0.0", default-features = false, features = ["rt-async-std", "sync"] }Add a runtime crate to your project as well (
tokioorasync-std), matching thert-*feature you chose. -
Build the project:
cargo build
Verify
Confirm the crate resolves and the project builds:
cargo buildExpected: the build completes without errors, and Cargo.lock lists an
aerospike entry at the version you added.
Next steps
Usage examples
Ready for more code examples? We have usage examples for all the basic CRUD operations.
Error handling
Actionable errors with recovery suggestions. Know exactly what went wrong and how to fix it.