dicedb-rs

Crates.iodicedb-rs
lib.rsdicedb-rs
version0.1.5
created_at2025-03-16 23:06:13.366572+00
updated_at2025-03-24 16:59:39.247985+00
descriptionRust SDK for DiceDb.
homepage
repositoryhttps://github.com/DanielHauge/dicedb-rs
max_upload_size
id1594848
size141,292
Daniel Hauge (DanielHauge)

documentation

README

Getting Started · Examples · Docs

Tests Crate.io DiceDB Discord License

DiceDB Unofficial Rust SDK

DiceDB is an open-source, fast, reactive, in-memory database optimized for modern hardware. The source code for DiceDB can be found in the DiceDB Github repository.

[!WARNING] This SDK project is under active development without any stable API yet. A base implementation is made to support all operations of DiceDB.

Getting Started

DiceDB must be running to use the SDK, read more at the DiceDB Getting Started.

A local container can be started with:

docker run -p 7379:7379 dicedb/dicedb

Add the SDK as depedency to your Rust project.

cargo add dicedb-rs

A Simple examples of how to use the sdk:

fn main() -> Result<(), client::ClientError> {
    // Create a new client
    let mut client = Client::new("localhost".to_string(), 7379)?;

    // Set a key
    client.set("Hello", "World")?;

    // Get a key
    let value = client.get("Hello")?;
    println!("Hello: {}", value);

    // Subscribe to changes in the Hello key
    let (hello_changes, _) = client.get_watch("Hello")?;

    // Listen for changes
    for change in hello_changes {
        eprintln!("There was a change: {:?}", change);
    }

    Ok(())
}

More examples of programs using the SDK can be found in the examples.

Development

To contribute and develop the SDK, the following pre-requisites are needed to build and test the project:

Clone the repository and remember to checkout the protos submodule.

Build with:

cargo build

Run tests with:

cargo test

Run benchmarks with:

cargo bench
Commit count: 45

cargo fmt