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>

source

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.

source

pub fn with_cache(self, cache: &'cache mut dyn TrieCache<L::Codec>) -> Self

Use the given cache for the db.

source

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.

source

pub fn with_recorder( self, recorder: &'cache mut dyn TrieRecorder<TrieHash<L>> ) -> Self

Use the given recorder to record trie accesses.

source

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.

source

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

Build the TrieDB.

Auto Trait Implementations§

§

impl<'db, 'cache, L> Freeze for TrieDBBuilder<'db, 'cache, L>

§

impl<'db, 'cache, L> !RefUnwindSafe for TrieDBBuilder<'db, 'cache, L>

§

impl<'db, 'cache, L> !Send for TrieDBBuilder<'db, 'cache, L>

§

impl<'db, 'cache, L> !Sync for TrieDBBuilder<'db, 'cache, L>

§

impl<'db, 'cache, L> Unpin for TrieDBBuilder<'db, 'cache, L>

§

impl<'db, 'cache, L> !UnwindSafe for TrieDBBuilder<'db, 'cache, L>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.