Struct sp_trie::KeySpacedDBMut
source · pub struct KeySpacedDBMut<'a, DB: ?Sized, H>(/* private fields */);
Expand description
HashDBMut
implementation that append a encoded prefix (unique id bytes) in addition to the
prefix of every key value.
Mutable variant of KeySpacedDB
, see KeySpacedDB
.
Implementations§
source§impl<'a, DB: ?Sized, H> KeySpacedDBMut<'a, DB, H>
impl<'a, DB: ?Sized, H> KeySpacedDBMut<'a, DB, H>
sourcepub fn new(db: &'a mut DB, ks: &'a [u8]) -> Self
pub fn new(db: &'a mut DB, ks: &'a [u8]) -> Self
instantiate new keyspaced db
Trait Implementations§
source§impl<'a, DB, H, T> AsHashDB<H, T> for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H, T> AsHashDB<H, T> for KeySpacedDBMut<'a, DB, H>
source§fn as_hash_db(&self) -> &dyn HashDB<H, T>
fn as_hash_db(&self) -> &dyn HashDB<H, T>
Perform upcast to HashDB for anything that derives from HashDB.
source§fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn HashDB<H, T> + 'b)
fn as_hash_db_mut<'b>(&'b mut self) -> &'b mut (dyn HashDB<H, T> + 'b)
Perform mutable upcast to HashDB for anything that derives from HashDB.
source§impl<'a, DB, H, T> HashDB<H, T> for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H, T> HashDB<H, T> for KeySpacedDBMut<'a, DB, H>
source§fn get(&self, key: &H::Out, prefix: Prefix<'_>) -> Option<T>
fn get(&self, key: &H::Out, prefix: Prefix<'_>) -> Option<T>
Look up a given hash into the bytes that hash to it, returning None if the
hash is not known.
source§fn contains(&self, key: &H::Out, prefix: Prefix<'_>) -> bool
fn contains(&self, key: &H::Out, prefix: Prefix<'_>) -> bool
Check for the existence of a hash-key.
source§fn insert(&mut self, prefix: Prefix<'_>, value: &[u8]) -> H::Out
fn insert(&mut self, prefix: Prefix<'_>, value: &[u8]) -> H::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.Auto Trait Implementations§
impl<'a, DB, H> Freeze for KeySpacedDBMut<'a, DB, H>where
DB: ?Sized,
impl<'a, DB, H> RefUnwindSafe for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H> Send for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H> Sync for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H> Unpin for KeySpacedDBMut<'a, DB, H>
impl<'a, DB, H> !UnwindSafe for KeySpacedDBMut<'a, DB, H>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from
.