Crates.io | valkey-module |
lib.rs | valkey-module |
version | 0.1.2 |
source | src |
created_at | 2024-04-28 14:45:13.727028 |
updated_at | 2024-09-12 21:52:46.804039 |
description | A toolkit for building valkey modules in Rust |
homepage | |
repository | https://github.com/valkey-io/valkeymodule-rs |
max_upload_size | |
id | 1223293 |
size | 481,773 |
This crate provides an idiomatic Rust API for the Valkey Modules API. It allows writing Valkey modules in Rust, without needing to use raw pointers or unsafe code. See here for the most recent API documentation.
This repo was forked from redismodule-rs. We appreciate the contributions of the original authors.
cargo build --example hello
hello
module
valkey-server --loadmodule ./target/debug/examples/libhello.so
valkey-server --loadmodule ./target/debug/examples/libhello.dylib
HELLO.MUL 31 11
.See the examples directory for some sample modules.
To optionally enter the System.alloc
code paths in alloc.rs
specify this in Cargo.toml
of your module:
[features]
enable-system-alloc = ["valkey-module/system-alloc"]
For unit tests with System.alloc
use this:
cargo test --features enable-system-alloc
For integration tests with ValkeyAlloc
use this:
cargo test
This crate tries to provide high-level wrappers around the standard Valkey Modules API, while preserving the API's basic concepts. Therefore, following the Valkeyi Modules API documentation will be mostly relevant here as well.