leveldb-rs-binding 2.0.0

An interface for the LevelDB
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::utils::tmpdir;
use leveldb::database::Database;
use leveldb::database::cache::Cache;
use leveldb::options::Options;

#[test]
fn test_open_database_with_cache() {
    let mut opts = Options::new();
    opts.create_if_missing = true;
    opts.cache = Some(Cache::new(20));
    let tmp = tmpdir("create_if_missing");
    let res: Result<Database, _> = Database::open(tmp.path(), opts);
    assert!(res.is_ok());
}