Struct patricia_trie::FatDBMut [−][src]
A mutable Trie
implementation which hashes keys and uses a generic HashDB
backing database.
Additionaly it stores inserted hash-key mappings for later retrieval.
Use it as a Trie
or TrieMut
trait object.
Methods
impl<'db, H, C> FatDBMut<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
[src]
impl<'db, H, C> FatDBMut<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
pub fn new(db: &'db mut HashDB<H>, root: &'db mut H::Out) -> Self
[src]
pub fn new(db: &'db mut HashDB<H>, root: &'db mut H::Out) -> Self
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.
pub fn from_existing(
db: &'db mut HashDB<H>,
root: &'db mut H::Out
) -> Result<Self, H::Out, C::Error>
[src]
pub fn from_existing(
db: &'db mut HashDB<H>,
root: &'db mut H::Out
) -> Result<Self, H::Out, C::Error>
Create a new trie with the backing database db
and root
.
Returns an error if root does not exist.
pub fn db(&self) -> &HashDB<H>
[src]
pub fn db(&self) -> &HashDB<H>
Get the backing database.
pub fn db_mut(&mut self) -> &mut HashDB<H>
[src]
pub fn db_mut(&mut self) -> &mut HashDB<H>
Get the backing database.
Trait Implementations
impl<'db, H, C> TrieMut<H, C> for FatDBMut<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
[src]
impl<'db, H, C> TrieMut<H, C> for FatDBMut<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
fn root(&mut self) -> &H::Out
[src]
fn root(&mut self) -> &H::Out
Return the root of the trie.
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Is the trie empty?
fn contains(&self, key: &[u8]) -> Result<bool, H::Out, C::Error>
[src]
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,
[src]
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?
fn insert(
&mut self,
key: &[u8],
value: &[u8]
) -> Result<Option<DBValue>, H::Out, C::Error>
[src]
fn insert(
&mut self,
key: &[u8],
value: &[u8]
) -> Result<Option<DBValue>, H::Out, C::Error>
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>, H::Out, C::Error>
[src]
fn remove(&mut self, key: &[u8]) -> Result<Option<DBValue>, H::Out, C::Error>
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