referrerpolicy=no-referrer-when-downgrade
sp_trie

Type Alias TrieDBBuilder

Source
pub type TrieDBBuilder<'a, 'cache, L> = TrieDBBuilder<'a, 'cache, L>;
Expand description

Builder for creating a TrieDB.

Aliased Type§

struct TrieDBBuilder<'a, 'cache, L> { /* private fields */ }

Implementations

§

impl<'db, 'cache, L> TrieDBBuilder<'db, 'cache, L>
where L: TrieLayout,

pub fn new( db: &'db dyn HashDBRef<<L as TrieLayout>::Hash, Vec<u8>>, root: &'db <<L as TrieLayout>::Hash as Hasher>::Out, ) -> TrieDBBuilder<'db, 'cache, L>

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.

pub fn with_cache( self, cache: &'cache mut dyn TrieCache<<L as TrieLayout>::Codec>, ) -> TrieDBBuilder<'db, 'cache, L>

Use the given cache for the db.

pub fn with_optional_cache<'ocache>( self, cache: Option<&'ocache mut dyn TrieCache<<L as TrieLayout>::Codec>>, ) -> TrieDBBuilder<'db, 'cache, L>
where 'ocache: 'cache,

Use the given optional cache for the db.

pub fn with_recorder( self, recorder: &'cache mut dyn TrieRecorder<<<L as TrieLayout>::Hash as Hasher>::Out>, ) -> TrieDBBuilder<'db, 'cache, L>

Use the given recorder to record trie accesses.

pub fn with_optional_recorder<'recorder>( self, recorder: Option<&'recorder mut dyn TrieRecorder<<<L as TrieLayout>::Hash as Hasher>::Out>>, ) -> TrieDBBuilder<'db, 'cache, L>
where 'recorder: 'cache,

Use the given optional recorder to record trie accesses.

pub fn build(self) -> TrieDB<'db, 'cache, L>

Build the [TrieDB].