Struct trie_db::triedb::TrieDBBuilder
source · pub struct TrieDBBuilder<'db, 'cache, L: TrieLayout> { /* private fields */ }
Expand description
A builder for creating a TrieDB
.
Implementations§
source§impl<'db, 'cache, L: TrieLayout> TrieDBBuilder<'db, 'cache, L>
impl<'db, 'cache, L: TrieLayout> TrieDBBuilder<'db, 'cache, L>
sourcepub fn new(
db: &'db dyn HashDBRef<L::Hash, DBValue>,
root: &'db TrieHash<L>
) -> Self
pub fn new( db: &'db dyn HashDBRef<L::Hash, DBValue>, root: &'db TrieHash<L> ) -> Self
Create a new trie-db builder with the backing database db
and root
.
This doesn’t check if root
exists in the given db
. If root
doesn’t exist it will fail
when trying to lookup any key.
sourcepub fn with_cache(self, cache: &'cache mut dyn TrieCache<L::Codec>) -> Self
pub fn with_cache(self, cache: &'cache mut dyn TrieCache<L::Codec>) -> Self
Use the given cache
for the db.
sourcepub fn with_optional_cache<'ocache: 'cache>(
self,
cache: Option<&'ocache mut dyn TrieCache<L::Codec>>
) -> Self
pub fn with_optional_cache<'ocache: 'cache>( self, cache: Option<&'ocache mut dyn TrieCache<L::Codec>> ) -> Self
Use the given optional cache
for the db.
sourcepub fn with_recorder(
self,
recorder: &'cache mut dyn TrieRecorder<TrieHash<L>>
) -> Self
pub fn with_recorder( self, recorder: &'cache mut dyn TrieRecorder<TrieHash<L>> ) -> Self
Use the given recorder
to record trie accesses.
sourcepub fn with_optional_recorder<'recorder: 'cache>(
self,
recorder: Option<&'recorder mut dyn TrieRecorder<TrieHash<L>>>
) -> Self
pub fn with_optional_recorder<'recorder: 'cache>( self, recorder: Option<&'recorder mut dyn TrieRecorder<TrieHash<L>>> ) -> Self
Use the given optional recorder
to record trie accesses.