[][src]Trait trie_db::Trie

pub trait Trie<H: Hasher, C: NodeCodec<H>> {
    fn root(&self) -> &H::Out;
fn get_with<'a, 'key, Q: Query<H>>(
        &'a self,
        key: &'key [u8],
        query: Q
    ) -> Result<Option<Q::Item>, H::Out, C::Error>
    where
        'a: 'key
;
fn iter<'a>(
        &'a self
    ) -> Result<Box<dyn TrieIterator<H, C, Item = TrieItem<H::Out, C::Error>> + 'a>, H::Out, C::Error>; fn is_empty(&self) -> bool { ... }
fn contains(&self, key: &[u8]) -> Result<bool, H::Out, C::Error> { ... }
fn get<'a, 'key>(
        &'a self,
        key: &'key [u8]
    ) -> Result<Option<DBValue>, H::Out, C::Error>
    where
        'a: 'key
, { ... } }

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

Required methods

fn root(&self) -> &H::Out

Return the root of the trie.

fn get_with<'a, 'key, Q: Query<H>>(
    &'a self,
    key: &'key [u8],
    query: Q
) -> Result<Option<Q::Item>, H::Out, C::Error> 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<H, C, Item = TrieItem<H::Out, C::Error>> + 'a>, H::Out, C::Error>

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, H::Out, C::Error>

Does the trie contain a given key?

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, H::Out, C::Error> where
    'a: 'key, 

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

Loading content...

Implementors

impl<'db, H, C> Trie<H, C> for SecTrieDB<'db, H, C> where
    H: Hasher,
    C: NodeCodec<H>, 
[src]

fn is_empty(&self) -> bool[src]

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, H::Out, C::Error> where
    'a: 'key, 
[src]

impl<'db, H, C> Trie<H, C> for FatDB<'db, H, C> where
    H: Hasher,
    C: NodeCodec<H>, 
[src]

fn is_empty(&self) -> bool[src]

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, H::Out, C::Error> where
    'a: 'key, 
[src]

impl<'db, H, C> Trie<H, C> for TrieDB<'db, H, C> where
    H: Hasher,
    C: NodeCodec<H>, 
[src]

fn is_empty(&self) -> bool[src]

fn contains(&self, key: &[u8]) -> Result<bool, H::Out, C::Error>[src]

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, H::Out, C::Error> where
    'a: 'key, 
[src]

impl<'db, H: Hasher, C: NodeCodec<H>> Trie<H, C> for TrieKinds<'db, H, C>[src]

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<DBValue>, H::Out, C::Error> where
    'a: 'key, 
[src]

Loading content...