Trait sp_trie::HashDBT [−][src]
Various re-exports from the hash-db
crate.
Trait modelling datastore keyed by a hash defined by the Hasher
.
Required methods
pub fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
Look up a given hash into the bytes that hash to it, returning None if the hash is not known.
pub fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
Check for the existance of a hash-key.
pub fn insert(
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out
[src]
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out
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.
pub fn emplace(
&mut self,
key: <H as Hasher>::Out,
prefix: (&[u8], Option<u8>),
value: T
)
[src]
&mut self,
key: <H as Hasher>::Out,
prefix: (&[u8], Option<u8>),
value: T
)
Like insert()
, except you provide the key and the data is all moved.
pub fn remove(&mut self, key: &<H as Hasher>::Out, prefix: (&[u8], Option<u8>))
[src]
Remove a datum previously inserted. Insertions can be “owed” such that the same number of
insert()
s may happen without the data being eventually being inserted into the DB.
It can be “owed” more than once.
Trait Implementations
impl<'a, H, T> AsHashDB<H, T> for &'a mut (dyn HashDB<H, T> + 'a) where
H: Hasher,
[src]
H: Hasher,
pub fn as_hash_db(&self) -> &dyn HashDB<H, T>
[src]
pub fn as_hash_db_mut(&'b mut self) -> &'b mut (dyn HashDB<H, T> + 'b)
[src]
impl<'a, H, T> HashDBRef<H, T> for &'a mut (dyn HashDB<H, T> + 'a) where
H: Hasher,
[src]
H: Hasher,
pub fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
pub fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
impl<'a, H, T> HashDBRef<H, T> for &'a (dyn HashDB<H, T> + 'a) where
H: Hasher,
[src]
H: Hasher,
Implementations on Foreign Types
impl<H, KF, T, M> HashDB<H, T> for MemoryDB<H, KF, T, M> where
H: Hasher,
T: Default + PartialEq<T> + for<'a> From<&'a [u8]> + Clone + Send + Sync,
KF: Send + Sync + KeyFunction<H>,
M: MemTracker<T> + Send + Sync,
[src]
H: Hasher,
T: Default + PartialEq<T> + for<'a> From<&'a [u8]> + Clone + Send + Sync,
KF: Send + Sync + KeyFunction<H>,
M: MemTracker<T> + Send + Sync,
pub fn get(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> Option<T>
pub fn contains(
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
[src]
&self,
key: &<H as Hasher>::Out,
prefix: (&[u8], Option<u8>)
) -> bool
pub fn emplace(
&mut self,
key: <H as Hasher>::Out,
prefix: (&[u8], Option<u8>),
value: T
)
[src]
&mut self,
key: <H as Hasher>::Out,
prefix: (&[u8], Option<u8>),
value: T
)
pub fn insert(
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out
[src]
&mut self,
prefix: (&[u8], Option<u8>),
value: &[u8]
) -> <H as Hasher>::Out
pub fn remove(&mut self, key: &<H as Hasher>::Out, prefix: (&[u8], Option<u8>))
[src]
Implementors
impl<'a, DB, H, T> HashDB<H, T> for KeySpacedDBMut<'a, DB, H> where
DB: HashDB<H, T>,
H: Hasher,
T: Default + PartialEq<T> + for<'b> From<&'b [u8]> + Clone + Send + Sync,
[src]
DB: HashDB<H, T>,
H: Hasher,
T: Default + PartialEq<T> + for<'b> From<&'b [u8]> + Clone + Send + Sync,