# Trait ethcore_util::trie::Trie [−] [src]

    pub trait Trie {
        fn root(&self) -> &H256;
        fn get_with<'a, 'key, Q: Query>(&'a self,
                                    key: &'key [u8],
                                    query: Q)
                                    -> Result<Option<Q::Item>> where 'a: 'key;
        fn iter<'a>(&'a self) -> Result<Box<TrieIterator<Item=TrieItem> + 'a>>;

        fn is_empty(&self) -> bool { ... }
        fn contains(&self, key: &[u8]) -> Result<bool> { ... }
        fn get<'a, 'key>(&'a self, key: &'key [u8]) -> Result<Option<DBValue>> where 'a: 'key { ... }
    }

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

## Required Methods

### `fn root(&self) -> &H256`

Return the root of the trie.

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

Returns a depth-first iterator over the elements of trie.

## Provided Methods

### `fn is_empty(&self) -> bool`

Is the trie empty?

### `fn contains(&self, key: &[u8]) -> Result<bool>`

Does the trie contain a given key?

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

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

## Implementors

- `impl<'db> Trie for TrieDB<'db>`
- `impl<'db> Trie for SecTrieDB<'db>`
- `impl<'db> Trie for FatDB<'db>`
- `impl<'db> Trie for TrieKinds<'db>`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)