[][src]Trait trie_db::Trie

pub trait Trie<L: TrieLayout> {
    fn root(&self) -> &TrieHash<L>;
fn get_with<'a, 'key, Q: Query<L::Hash>>(
        &'a self,
        key: &'key [u8],
        query: Q
    ) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>>
    where
        'a: 'key
;
fn iter<'a>(
        &'a self
    ) -> Result<Box<dyn TrieIterator<L, Item = TrieItem<'_, TrieHash<L>, CError<L>>> + 'a>, TrieHash<L>, CError<L>>; fn is_empty(&self) -> bool { ... }
fn contains(&self, key: &[u8]) -> Result<bool, TrieHash<L>, CError<L>> { ... }
fn get<'a, 'key>(
        &'a self,
        key: &'key [u8]
    ) -> Result<Option<DBValue>, TrieHash<L>, CError<L>>
    where
        'a: 'key
, { ... } }

A key-value datastore implemented as a database-backed modified Merkle tree.

Required methods

fn root(&self) -> &TrieHash<L>

Return the root of the trie.

fn get_with<'a, 'key, Q: Query<L::Hash>>(
    &'a self,
    key: &'key [u8],
    query: Q
) -> Result<Option<Q::Item>, TrieHash<L>, CError<L>> where
    'a: 'key, 

Search for the key with the given query parameter. See the docs of the Query trait for more details.

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.

Loading content...

Provided methods

fn is_empty(&self) -> bool

Is the trie empty?

fn contains(&self, key: &[u8]) -> Result<bool, TrieHash<L>, CError<L>>

Does the trie contain a given key?

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, TrieHash<L>, CError<L>> where
    'a: 'key, 

What is the value of the given key in this trie?

Loading content...

Implementors

impl<'db, L> Trie<L> for SecTrieDB<'db, L> where
    L: TrieLayout
[src]

impl<'db, L> Trie<L> for FatDB<'db, L> where
    L: TrieLayout
[src]

impl<'db, L> Trie<L> for TrieDB<'db, L> where
    L: TrieLayout
[src]

impl<'db, L: TrieLayout> Trie<L> for TrieKinds<'db, L>[src]

Loading content...