Type Alias sp_trie::TrieDBMutBuilder

source ·
pub type TrieDBMutBuilder<'a, L> = TrieDBMutBuilder<'a, L>;
Expand description

Builder for creating a TrieDBMut.

Aliased Type§

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

Implementations

source§

impl<'db, L> TrieDBMutBuilder<'db, L>
where L: TrieLayout,

source

pub fn new( db: &'db mut dyn HashDB<<L as TrieLayout>::Hash, Vec<u8>>, root: &'db mut <<L as TrieLayout>::Hash as Hasher>::Out, ) -> TrieDBMutBuilder<'db, L>

Create a builder for constructing a new trie with the backing database db and empty root.

source

pub fn from_existing( db: &'db mut dyn HashDB<<L as TrieLayout>::Hash, Vec<u8>>, root: &'db mut <<L as TrieLayout>::Hash as Hasher>::Out, ) -> TrieDBMutBuilder<'db, L>

Create a builder for constructing a new trie 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.

source

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

Use the given cache for the db.

source

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

Use the given optional cache for the db.

source

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

Use the given recorder to record trie accesses.

source

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

Use the given optional recorder to record trie accesses.

source

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

Build the TrieDBMut.