Struct patricia_trie::sectriedbmut::SecTrieDBMut
[−]
[src]
pub struct SecTrieDBMut<'db> { /* fields omitted */ }
A mutable Trie
implementation which hashes keys and uses a generic HashDB
backing database.
Use it as a Trie
or TrieMut
trait object. You can use raw()
to get the backing TrieDBMut
object.
Methods
impl<'db> SecTrieDBMut<'db>
[src]
fn new(db: &'db mut HashDB, root: &'db mut H256) -> Self
[src]
Create a new trie with the backing database db
and empty root
Initialise to the state entailed by the genesis block.
This guarantees the trie is built correctly.
fn from_existing(db: &'db mut HashDB, root: &'db mut H256) -> Result<Self>
[src]
Create a new trie with the backing database db
and root
.
Returns an error if root does not exist.
fn db(&self) -> &HashDB
[src]
Get the backing database.
fn db_mut(&mut self) -> &mut HashDB
[src]
Get the backing database.
Trait Implementations
impl<'db> TrieMut for SecTrieDBMut<'db>
[src]
fn root(&mut self) -> &H256
[src]
Return the root of the trie.
fn is_empty(&self) -> bool
[src]
Is the trie empty?
fn contains(&self, key: &[u8]) -> Result<bool>
[src]
Does the trie contain a given key?
fn get<'a, 'key>(&'a self, key: &'key [u8]) -> Result<Option<DBValue>> where
'a: 'key,
[src]
'a: 'key,
What is the value of the given key in this trie?
fn insert(&mut self, key: &[u8], value: &[u8]) -> Result<Option<DBValue>>
[src]
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. Read more
fn remove(&mut self, key: &[u8]) -> Result<Option<DBValue>>
[src]
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. Read more