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

    pub trait TrieMut {
        fn root(&mut self) -> &H256;
        fn is_empty(&self) -> bool;
        fn get<'a, 'key>(&'a self, key: &'key [u8]) -> Result<Option<DBValue>> where 'a: 'key;
        fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<DBValue>>;
        fn remove(&mut self, key: &[u8]) -> Result<Option<DBValue>>;

        fn contains(&self, key: &[u8]) -> Result<bool> { ... }
    }

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

## Required Methods

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

Return the root of the trie.

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

Is the trie empty?

### `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?

### `fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<DBValue>>`

Insert a `key`/`value` pair into the trie. An empty value is equivalent to removing `key` from the trie. Returns the old value associated with this key, if it existed.

### `fn remove(&mut self, key: &[u8]) -> Result<Option<DBValue>>`

Remove a `key` from the trie. Equivalent to making it equal to the empty value. Returns the old value associated with this key, if it existed.

## Provided Methods

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

Does the trie contain a given key?

## Implementors

- `impl<'a> TrieMut for TrieDBMut<'a>`
- `impl<'db> TrieMut for SecTrieDBMut<'db>`
- `impl<'db> TrieMut for FatDBMut<'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`)