| Crates.io | vsdb_trie_db |
| lib.rs | vsdb_trie_db |
| version | 5.0.0 |
| created_at | 2023-03-25 13:22:16.133523+00 |
| updated_at | 2025-08-11 04:13:26.141047+00 |
| description | An out-of-box wraper of the `trie_db` crate |
| homepage | https://github.com/rust-util-collections/vsdb |
| repository | https://github.com/rust-util-collections/vsdb |
| max_upload_size | |
| id | 820244 |
| size | 83,333 |
An out-of-box wrapper of the
trie_dbcrate.
This crate provides an out-of-the-box wrapper for trie-db, based on the powerful vsdb crate.
Add this to your Cargo.toml:
[dependencies]
vsdb_trie_db = "4.0"
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");
This project is licensed under the MIT license.