vsdb_trie_db

Crates.iovsdb_trie_db
lib.rsvsdb_trie_db
version5.0.0
created_at2023-03-25 13:22:16.133523+00
updated_at2025-08-11 04:13:26.141047+00
descriptionAn out-of-box wraper of the `trie_db` crate
homepagehttps://github.com/rust-util-collections/vsdb
repositoryhttps://github.com/rust-util-collections/vsdb
max_upload_size
id820244
size83,333
中正 (haxjump)

documentation

README

vsdb_trie_db

Crates.io Docs.rs License Rust

An out-of-box wrapper of the trie_db crate.

This crate provides an out-of-the-box wrapper for trie-db, based on the powerful vsdb crate.

Installation

Add this to your Cargo.toml:

[dependencies]
vsdb_trie_db = "4.0"

Usage

vsdb_trie_db provides an out-of-the-box wrapper for the trie-db crate, backed by vsdb.

use vsdb_trie_db::MptStore;

// Create a new MptStore
let mut store = MptStore::new();

// Initialize a new trie with a backend key
let mut trie = store.trie_init(b"my_trie").unwrap();

// Insert a key-value pair
trie.insert(b"key1", b"value1").unwrap();

// Commit the changes to the trie
let mut trie = trie.commit().unwrap();
let root = trie.root();

// Retrieve the value
let value = trie.get(b"key1").unwrap().unwrap();
assert_eq!(value, b"value1");

// Create a read-only handle to the trie at a specific root
let ro_trie = trie.ro_handle(root).unwrap();
let value = ro_trie.get(b"key1").unwrap().unwrap();
assert_eq!(value, b"value1");

License

This project is licensed under the MIT license.

Commit count: 382

cargo fmt