How to run a sample example?
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 274
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Description
I am unable to execute this test:
use hash_db::Hasher;
use reference_trie::{RefTrieDBMut, RefTrieDB};
use trie_db::DBValue;
use keccak_hasher::KeccakHasher;
use memory_db::*;
fn main() {
let mut memdb = MemoryDB::<KeccakHasher, HashKey<_>, _>::default();
let mut root = Default::default();
RefTrieDBMut::new(&mut memdb, &mut root).insert(b"foo", b"bar").unwrap();
let t = RefTrieDB::new(&memdb, &root);
assert!(t.contains(b"foo").unwrap());
assert_eq!(t.get(b"foo").unwrap().unwrap(), b"bar".to_vec());
}
But I get this error:
--> src/main.rs:10:19
|
10 | RefTrieDBMut::new(&mut memdb, &mut root).insert(b"foo", b"bar").unwrap();
| ^^^ function or associated item not found in `trie_db::triedbmut::TrieDBMut<'_, ExtensionLayout>`
And Indeed trie_db::triedbmut::TrieDBMut doesn't have a new method. Any help?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing call in src/main.rs and inspect the crate versions and APIs for RefTrieDBMut and RefTrieDB. Compare the example's imports and constructor usage with the currently exposed API. Done means the sample compiles and its assertions pass, or the example documents the correct way to run it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100