pub struct SecTrieDB<'db, 'cache, L> where
L: TrieLayout, { /* private fields */ }
Expand description
A Trie
implementation which hashes keys and uses a generic HashDB
backing database.
Use it as a Trie
trait object. You can use raw()
to get the backing TrieDB
object.
Implementations
sourceimpl<'db, 'cache, L> SecTrieDB<'db, 'cache, L> where
L: TrieLayout,
impl<'db, 'cache, L> SecTrieDB<'db, 'cache, L> where
L: TrieLayout,
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 with the backing database db
and root
.
Initialise to the state entailed by the genesis block. This guarantees the trie is built correctly.
Trait Implementations
sourceimpl<'db, 'cache, L> Trie<L> for SecTrieDB<'db, 'cache, L> where
L: TrieLayout,
impl<'db, 'cache, L> Trie<L> for SecTrieDB<'db, 'cache, L> where
L: TrieLayout,
sourcefn contains(&self, key: &[u8]) -> Result<bool, TrieHash<L>, CError<L>>
fn contains(&self, key: &[u8]) -> Result<bool, TrieHash<L>, CError<L>>
Does the trie contain a given key?
sourcefn get_hash(
&self,
key: &[u8]
) -> Result<Option<TrieHash<L>>, TrieHash<L>, CError<L>>
fn get_hash(
&self,
key: &[u8]
) -> Result<Option<TrieHash<L>>, TrieHash<L>, CError<L>>
Returns the hash of the value for key
.
sourcefn get_with<Q: Query<L::Hash>>(
&self,
key: &[u8],
query: Q
) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>>
fn get_with<Q: Query<L::Hash>>(
&self,
key: &[u8],
query: Q
) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>>
Search for the key with the given query parameter. See the docs of the Query
trait for more details. Read more
sourcefn iter<'a>(
&'a self
) -> Result<Box<dyn TrieIterator<L, Item = TrieItem<TrieHash<L>, CError<L>>> + 'a>, TrieHash<L>, CError<L>>
fn iter<'a>(
&'a self
) -> Result<Box<dyn TrieIterator<L, Item = TrieItem<TrieHash<L>, CError<L>>> + 'a>, TrieHash<L>, CError<L>>
Returns a depth-first iterator over the elements of trie.
sourcefn key_iter<'a>(
&'a self
) -> Result<Box<dyn TrieIterator<L, Item = TrieKeyItem<TrieHash<L>, CError<L>>> + 'a>, TrieHash<L>, CError<L>>
fn key_iter<'a>(
&'a self
) -> Result<Box<dyn TrieIterator<L, Item = TrieKeyItem<TrieHash<L>, CError<L>>> + 'a>, TrieHash<L>, CError<L>>
Returns a depth-first iterator over the keys of elemets of trie.
Auto Trait Implementations
impl<'db, 'cache, L> !RefUnwindSafe for SecTrieDB<'db, 'cache, L>
impl<'db, 'cache, L> !Send for SecTrieDB<'db, 'cache, L>
impl<'db, 'cache, L> !Sync for SecTrieDB<'db, 'cache, L>
impl<'db, 'cache, L> Unpin for SecTrieDB<'db, 'cache, L>
impl<'db, 'cache, L> !UnwindSafe for SecTrieDB<'db, 'cache, L>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more