PickleDB-rs is a lightweight and simple key-value store. It is a Rust version for Python's PickleDB
Branch: master
Clone or download
Latest commit 34eef8a Feb 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Bugfix #3 - Add proper error handling Feb 1, 2019
src Use Path and PathBuf instead of strings Feb 5, 2019
tests Workaround to fix tests + small fix in set() Feb 3, 2019
.gitignore Add more documentation Jan 15, 2019
.travis.yml Build examples in Travis-CI Jan 18, 2019
Cargo.toml Bump version to 0.3.0 Feb 5, 2019
LICENSE Create LICENSE Jan 9, 2019
README.md Bump version to 0.3.0 Feb 5, 2019



Build Status Crate API

PickleDB is a lightweight and simple key-value store written in Rust, heavily inspired by Python's PickleDB

PickleDB is fun and easy to use

use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod};

fn main() {
    // create a new DB with AutoDump (meaning every change is written to the file)
    // and with Json serialization (meaning DB will be dumped to file as a Json object)
    let mut db = PickleDb::new("example.db", PickleDbDumpPolicy::AutoDump, SerializationMethod::Json);
    // set the value 100 to the key 'key1'
    db.set("key1", &100).unwrap();
    // print the value of key1
    println!("The value of key1 is: {}", db.get::<i32>("key1").unwrap());

    // load the DB from the same file
    let db2 = PickleDb::load("example.db", PickleDbDumpPolicy::DumpUponRequest, SerializationMethod::Json).unwrap();

    // print the value of key1
    println!("The value of key1 as loaded from file is: {}", db2.get::<i32>("key1").unwrap());


This crate works with Cargo and can be found in crates.io Add this to your Cargo.toml:

pickledb = "0.3.0"


All documentation for this crate can be found in docs.rs


There are currently two examples shipped with PickleDB:

  • Hello World which shows the basic usage of PickleDB: create a new DB, load a DB from file, get/set key-value pairs of different types, and more
  • Lists which shows how to use lists in PickleDB: create new lists, add/remove items from lists, retrieve items from lists, remove lists, and more


Version 0.3.0

  • Added new serialization options. Now PickleDB supports JSON, Bincode, YAML and CBOR serializations
  • Added proper error handling (Issue #3)
  • Use Path and PathBuf instead of strings to describe DB paths
  • Better organization of the code

Version 0.2.0