Struct patricia_trie::sectriedb::SecTrieDB [−][src]
A Trie
implementation which hashes keys and uses a generic HashDB
backing database.
Use it as a Trie
trait object. You can use raw()
to get the backing TrieDB
object.
Methods
impl<'db, H, C> SecTrieDB<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
[src]
impl<'db, H, C> SecTrieDB<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
pub fn new(
db: &'db HashDB<H>,
root: &'db H::Out
) -> Result<Self, H::Out, C::Error>
[src]
pub fn new(
db: &'db HashDB<H>,
root: &'db H::Out
) -> Result<Self, H::Out, C::Error>
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. Returns an error if root does not exist.
pub fn raw(&self) -> &TrieDB<H, C>
[src]
pub fn raw(&self) -> &TrieDB<H, C>
Get a reference to the underlying raw TrieDB
struct.
pub fn raw_mut(&mut self) -> &mut TrieDB<'db, H, C>
[src]
pub fn raw_mut(&mut self) -> &mut TrieDB<'db, H, C>
Get a mutable reference to the underlying raw TrieDB
struct.
Trait Implementations
impl<'db, H, C> Trie<H, C> for SecTrieDB<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
[src]
impl<'db, H, C> Trie<H, C> for SecTrieDB<'db, H, C> where
H: Hasher,
C: NodeCodec<H>,
fn root(&self) -> &H::Out
[src]
fn root(&self) -> &H::Out
Return the root of the trie.
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_with<'a, 'key, Q: Query<H>>(
&'a self,
key: &'key [u8],
query: Q
) -> Result<Option<Q::Item>, H::Out, C::Error> where
'a: 'key,
[src]
fn get_with<'a, 'key, Q: Query<H>>(
&'a self,
key: &'key [u8],
query: Q
) -> Result<Option<Q::Item>, H::Out, C::Error> where
'a: 'key,
Search for the key with the given query parameter. See the docs of the Query
trait for more details. Read more
fn iter<'a>(
&'a self
) -> Result<Box<TrieIterator<H, C, Item = TrieItem<H::Out, C::Error>> + 'a>, H::Out, C::Error>
[src]
fn iter<'a>(
&'a self
) -> Result<Box<TrieIterator<H, C, Item = TrieItem<H::Out, C::Error>> + 'a>, H::Out, C::Error>
Returns a depth-first iterator over the elements of trie.
fn is_empty(&self) -> bool
[src]
fn is_empty(&self) -> bool
Is the trie empty?
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?