Install the Aerospike Rust client
Versions
-
The latest stable release of the Rust client is version 2.0.0.
-
With version 3.0.0, the Rust client will become an officially supported Aerospike client library.
Prerequisites
| Client version | Minimum Rust version |
|---|---|
| 2.0.0 | 1.86 |
| 1.3.0 | 1.34 |
To use the client in your own project, you must select whether to use Tokio or async-std for your async runtime.
For Tokio, use:
cargo add tokiocargo add aerospike@2.0.0 --features rt-tokioFor async-std, use:
cargo add async-stdcargo add aerospike@2.0.0 --features rt-async-stdBuild from source code
-
Clone the Git repository:
git clone --single-branch --branch v2 https://github.com/aerospike/aerospike-client-rust.gitcd aerospike-client-rust -
Build the project:
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 Runtimeaerospike = { version = "VERSION", features = ["rt-tokio"]}# OR# Async API with async-std runtimeaerospike = { version = "VERSION", features = ["rt-async-std"]}# The library still supports the old sync interface, but it will be deprecated in the future.# This is only for compatibility reasons and will be removed in a later stage.# Sync API with tokioaerospike = { version = "VERSION", default-features = false, features = ["rt-tokio", "sync"]}# OR# Sync API with async-stdaerospike = { version = "VERSION", default-features = false, features = ["rt-async-std", "sync"]} -
Build the project:
cargo build
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.