Crate of the Week

I would like to self-suggest a new crate of mine, called venndb. It is an append-only memory DB that you can make from any named-field script with a simple derive macro. Its primary use case is for high-intensive workloads where you typically have static data (read: write all at once at start of process) from which you query data all the time, using binary (read boolean) filters for the most part.

Crate can be found at: crates.io: Rust Package Registry

Docs can be found at: venndb - Rust

Usage example:

use venndb::VennDB

#[derive(Debug, VennDB)]
pub struct Employee {
    #[venndb(key)]
    id: u32,
    name: String,
    is_manager: bool,
    is_admin: bool,
    #[venndb(skip)]
    foo: bool,
    #[venndb(filter)]
    department: Department,
}

fn main() {
    let db = EmployeeDB::from_iter(/* .. */);

    let mut query = db.query();
    let employee = query
        .is_admin(true)
        .is_manager(false)
        .department(Department::Engineering)
        .execute()
        .expect("to have found at least one")
        .any();

    println!("non-manager admin engineer: {:?}", employee);
}

We use it in production ourselves already, but now that the first release is out on crates.io, I would love to have feedback from other users, as they might come up with use cases or problems we didn't consider yet ourselves.

Thanks in advance and take care.

2 Likes