[][src]Trait reference_trie::Trie

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

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

Required methods

fn root(&self) -> &<H as Hasher>::Out

Return the root of the trie.

fn get_with<'a, 'key, Q>(
    &'a self,
    key: &'key [u8],
    query: Q
) -> Result<Option<<Q as Query<H>>::Item>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key,
    Q: Query<H>, 

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

fn iter(
    &'a self
) -> Result<Box<dyn TrieIterator<H, C, Item = Result<(Vec<u8>, ElasticArray128<u8>), Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>>> + 'a>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::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, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>>

Does the trie contain a given key?

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<ElasticArray128<u8>>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key, 

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

Loading content...

Implementations on Foreign Types

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

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

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<ElasticArray128<u8>>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key, 
[src]

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

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

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<ElasticArray128<u8>>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key, 
[src]

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

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

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

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<ElasticArray128<u8>>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key, 
[src]

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

fn get<'a, 'key>(
    &'a self,
    key: &'key [u8]
) -> Result<Option<ElasticArray128<u8>>, Box<TrieError<<H as Hasher>::Out, <C as NodeCodec<H>>::Error>>> where
    'a: 'key, 
[src]

Loading content...

Implementors

Loading content...