pub struct Database { /* private fields */ }
Expand description
Database backed by both IndexedDB and in memory implementation.
Implementations§
Trait Implementations§
Source§impl KeyValueDB for Database
impl KeyValueDB for Database
Source§fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Option<Box<[u8]>>
fn get_by_prefix(&self, col: u32, prefix: &[u8]) -> Option<Box<[u8]>>
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 = (Box<[u8]>, Box<[u8]>)> + 'a>
fn iter<'a>( &'a self, col: u32, ) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + '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 = (Box<[u8]>, Box<[u8]>)> + 'a>
fn iter_with_prefix<'a>( &'a self, col: u32, prefix: &'a [u8], ) -> Box<dyn Iterator<Item = (Box<[u8]>, Box<[u8]>)> + 'a>
Iterate over the data for a given column, returning all key/value pairs
where the key starts with the given prefix.
Source§fn restore(&self, _new_db: &str) -> Result<()>
fn restore(&self, _new_db: &str) -> Result<()>
Attempt to replace this database with a new one located at the given path.
Source§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
Source§impl MallocSizeOf for Database
impl MallocSizeOf for Database
Source§fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
fn size_of(&self, _: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
If
T::size_of
is a constant, consider implementing constant_size
as well.Source§fn constant_size() -> Option<usize>
fn constant_size() -> Option<usize>
Used to optimize
MallocSizeOf
implementation for collections
like Vec
and HashMap
to avoid iterating over them unnecessarily.
The Self: Sized
bound is for object safety.Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnwindSafe for Database
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> MallocSizeOfExt for Twhere
T: MallocSizeOf,
impl<T> MallocSizeOfExt for Twhere
T: MallocSizeOf,
Source§fn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a
fresh state.