Closed cameron1024 closed 1 month ago
Since this is using the RocksDB raw iterator API, you must first check if the entry is valid before trying to access the key, and you also need to first seek the iterator to the start. You should be able to do it like this:
fn merk_len(merk: &Merk) -> usize {
let mut count = 0;
let mut iter = merk.raw_iter();
iter.seek_to_first();
while iter.valid() {
count += 1;
iter.next();
}
count
}
Closing due to inactivity.
This seems like a really simple question, but I can't find which part of the API to use :sweat_smile:
I tried this code:
but unfortunately this segfaults.
Is there a simple way to count how many keys are present in the tree?