typedb

Crates.iotypedb
lib.rstypedb
version0.9.0
sourcesrc
created_at2017-05-17 13:05:53.115253
updated_at2019-09-04 19:03:23.99544
descriptionSimple persistent generic HashMap/Key-value store
homepagehttps://github.com/mount-research/typedb
repositoryhttps://github.com/mount-research/typedb
max_upload_size
id14921
size24,192
shockham (shockham)

documentation

https://docs.rs/typedb

README

typedb

crates.io version Build status Documentation

Simple persistent generic HashMap/Key-value store, using file locking to limit writing between threads.

This is in a beta state at the moment.

Documentation

Basic usage:

use typedb::{ KV, Value };

fn main() {
    let mut test_store = KV::<String, Value>::new("./db.cab");

    let _ = test_store.insert("key".to_string(), Value::String("value".to_string()));
    println!("{:?}", test_store.get("key".to_string()));
    let _ = test_store.remove("key".to_string());
}

Usage with user defined Key and Value types:

use typedb::{KV, key, value};
use serde_derive::{ Serialize, Deserialize };

key!(
enum MyKey {
    String(String),
    Int(i32),
});

value!(
enum MyValue {
    String(String),
    Int(i32),
});

fn main() {
    let mut test_store = KV::<MyKey, MyValue>::new("./db.cab").unwrap();

    let _ = test_store.insert(MyKey::Int(1i32), MyValue::String("value".to_string()));
    println!("{:?}", test_store.get(MyKey::Int(1i32)));
    let _ = test_store.remove(MyKey::Int(1i32));
}

License

Commit count: 150

cargo fmt