Struct TestTrieCache

Source
pub struct TestTrieCache<L: TrieLayout> { /* private fields */ }
Expand description

Example trie cache implementation.

Should not be used for anything in production.

Implementations§

Source§

impl<L: TrieLayout> TestTrieCache<L>

Source

pub fn clear_value_cache(&mut self)

Clear the value cache.

Source

pub fn clear_node_cache(&mut self)

Clear the node cache.

Trait Implementations§

Source§

impl<L: TrieLayout> Default for TestTrieCache<L>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<L: TrieLayout> TrieCache<<L as TrieLayout>::Codec> for TestTrieCache<L>

Source§

fn lookup_value_for_key( &mut self, key: &[u8], ) -> Option<&CachedValue<TrieHash<L>>>

Lookup value for the given key. Read more
Source§

fn cache_value_for_key(&mut self, key: &[u8], value: CachedValue<TrieHash<L>>)

Cache the given value for the given key. Read more
Source§

fn get_or_insert_node( &mut self, hash: TrieHash<L>, fetch_node: &mut dyn FnMut() -> Result<NodeOwned<TrieHash<L>>, TrieHash<L>, CError<L>>, ) -> Result<&NodeOwned<TrieHash<L>>, TrieHash<L>, CError<L>>

Get or insert a NodeOwned. Read more
Source§

fn get_node(&mut self, hash: &TrieHash<L>) -> Option<&NodeOwned<TrieHash<L>>>

Get the NodeOwned that corresponds to the given hash.

Auto Trait Implementations§

§

impl<L> Freeze for TestTrieCache<L>

§

impl<L> RefUnwindSafe for TestTrieCache<L>
where <<L as TrieLayout>::Hash as Hasher>::Out: RefUnwindSafe,

§

impl<L> Send for TestTrieCache<L>

§

impl<L> Sync for TestTrieCache<L>

§

impl<L> Unpin for TestTrieCache<L>
where <<L as TrieLayout>::Hash as Hasher>::Out: Unpin,

§

impl<L> UnwindSafe for TestTrieCache<L>
where <<L as TrieLayout>::Hash as Hasher>::Out: UnwindSafe,

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>,

Source§

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>,

Source§

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.