#api

trivialdb

Rust bindings for the TDB database library

9 releases

0.1.8 Sep 24, 2024
0.1.7 Aug 16, 2024
0.1.5 Jul 29, 2024
0.1.4 Aug 28, 2023
0.1.1 Jun 12, 2023

#591 in Database interfaces

Download history 40/week @ 2024-06-24 16/week @ 2024-07-01 9/week @ 2024-07-08 17/week @ 2024-07-15 1/week @ 2024-07-22 198/week @ 2024-07-29 92/week @ 2024-08-05 267/week @ 2024-08-12 20/week @ 2024-08-19 41/week @ 2024-08-26 40/week @ 2024-09-02 8/week @ 2024-09-09 27/week @ 2024-09-16 220/week @ 2024-09-23 56/week @ 2024-09-30 18/week @ 2024-10-07

321 downloads per month
Used in silver-platter

LGPL-3.0-or-later

26KB
583 lines

Rust bindings for TDB

This rust crate provides idiomatic Rust bindings for the Trivial Database (TDB) library.

See the TDB homepage for more details.

Example

use trivialdb::{Tdb,Flags};

let mut tdb = Tdb::memory(None, Flags::empty()).unwrap();

tdb.store(b"key", b"value", None).unwrap();
assert_eq!(Some(b"value".to_vec()), tdb.fetch(b"key").unwrap());

lib.rs:

Rust bindings for TDB (Trivial Database)

TDB is a simple database that provides a key-value store. It is designed to be fast and reliable, and is used by Samba for storing data. It supports multiple readers and writers at the same time.

This crate provides a safe, rustic wrapper around the TDB C API.

Example

use trivialdb::{Flags,Tdb};

let mut tdb = Tdb::memory(None, Flags::empty()).unwrap();
tdb.store(b"foo", b"bar", None).unwrap();
assert_eq!(tdb.fetch(b"foo").unwrap().unwrap(), b"bar");

Dependencies

~0–2.3MB
~46K SLoC