Struct kvdb_memorydb::InMemory
source · pub struct InMemory { /* private fields */ }
Expand description
A key-value database fulfilling the KeyValueDB
trait, living in memory.
This is generally intended for tests and is not particularly optimized.
Trait Implementations§
source§impl KeyValueDB for InMemory
impl KeyValueDB for InMemory
source§fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Result<Option<DBValue>>
fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Result<Option<DBValue>>
Get the first value matching the given prefix.
source§fn write(&self, transaction: DBTransaction) -> Result<()>
fn write(&self, transaction: DBTransaction) -> Result<()>
Write a transaction of changes to the backing store.
source§fn iter<'a>(
&'a self,
col: u32
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
fn iter<'a>( &'a self, col: u32 ) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
Iterate over the data for a given column.
source§fn iter_with_prefix<'a>(
&'a self,
col: u32,
prefix: &'a [u8]
) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
fn iter_with_prefix<'a>( &'a self, col: u32, prefix: &'a [u8] ) -> Box<dyn Iterator<Item = Result<DBKeyValue>> + 'a>
Iterate over the data for a given column, returning all key/value pairs
where the key starts with the given prefix.
source§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
Auto Trait Implementations§
impl !RefUnwindSafe for InMemory
impl Send for InMemory
impl Sync for InMemory
impl Unpin for InMemory
impl UnwindSafe for InMemory
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