Trait trie_db::HashDB [−][src]
pub trait HashDB<H, T>: Send + Sync + AsHashDB<H, T> where
H: Hasher, { fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>; fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool; fn insert(
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out; fn emplace(
&mut self,
key: <H as Hasher>::Out,
prefix: (&[u8], Option<u8>),
value: T
); fn remove(&mut self, key: &<H as Hasher>::Out, prefix: (&[u8], Option<u8>)); }
Expand description
Trait modelling datastore keyed by a hash defined by the Hasher.
Required methods
fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>[src]
fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>[src]Look up a given hash into the bytes that hash to it, returning None if the hash is not known.
fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool[src]
fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool[src]Check for the existance of a hash-key.
fn insert(
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out[src]
fn insert(
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out[src]Insert a datum item into the DB and return the datum’s hash for a later lookup. Insertions
are counted and the equivalent number of remove()s must be performed before the data
is considered dead.
Trait Implementations
impl<'a, H, T> AsHashDB<H, T> for &'a mut (dyn HashDB<H, T> + 'a) where
H: Hasher, [src]
impl<'a, H, T> AsHashDB<H, T> for &'a mut (dyn HashDB<H, T> + 'a) where
H: Hasher, [src]pub fn as_hash_db(&self) -> &dyn HashDB<H, T>[src]
pub fn as_hash_db(&self) -> &dyn HashDB<H, T>[src]Perform upcast to HashDB for anything that derives from HashDB.
pub fn as_hash_db_mut(&'b mut self) -> &'b mut (dyn HashDB<H, T> + 'b)[src]
pub fn as_hash_db_mut(&'b mut self) -> &'b mut (dyn HashDB<H, T> + 'b)[src]Perform mutable upcast to HashDB for anything that derives from HashDB.
impl<'a, H, T> HashDBRef<H, T> for &'a (dyn HashDB<H, T> + 'a) where
H: Hasher, [src]
impl<'a, H, T> HashDBRef<H, T> for &'a (dyn HashDB<H, T> + 'a) where
H: Hasher, [src]