4 releases

new 0.1.3 Mar 20, 2025
0.1.2 Mar 17, 2025
0.1.1 Mar 16, 2025
0.1.0 Mar 16, 2025

#1779 in Database interfaces

Download history 256/week @ 2025-03-12

256 downloads per month

Custom license

80KB
2K SLoC

Getting Started · Examples · Docs

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

Dependencies

~5–12MB
~125K SLoC