pub struct Memory { /* private fields */ }Expand description
An in-memory key/value storage engine using the Rust standard library B-tree implementation. Data is not persisted.
Implementations§
Trait Implementations§
source§impl Engine for Memory
impl Engine for Memory
§type ScanIterator<'a> = MemoryScanIterator<'a>
type ScanIterator<'a> = MemoryScanIterator<'a>
The iterator returned by scan().
source§fn delete(&mut self, key: &[u8]) -> CResult<i64>
fn delete(&mut self, key: &[u8]) -> CResult<i64>
Deletes a key, or does nothing if it does not exist.
source§fn flush(&mut self) -> CResult<()>
fn flush(&mut self) -> CResult<()>
Flushes any buffered data to the underlying storage medium.
source§fn get(&mut self, key: &[u8]) -> CResult<Option<Vec<u8>>>
fn get(&mut self, key: &[u8]) -> CResult<Option<Vec<u8>>>
Gets a value for a key, if it exists.
source§fn scan(&mut self, range: impl RangeBounds<Vec<u8>>) -> Self::ScanIterator<'_>where
Self: Sized,
fn scan(&mut self, range: impl RangeBounds<Vec<u8>>) -> Self::ScanIterator<'_>where
Self: Sized,
Iterates over an ordered range of key/value pairs.
source§fn scan_dyn(
&mut self,
range: (Bound<Vec<u8>>, Bound<Vec<u8>>)
) -> Box<dyn ScanIteratorT + '_>
fn scan_dyn( &mut self, range: (Bound<Vec<u8>>, Bound<Vec<u8>>) ) -> Box<dyn ScanIteratorT + '_>
Like scan, but can be used from trait objects. The iterator will use
dynamic dispatch, which has a minor performance penalty.
source§fn set(&mut self, key: &[u8], value: Vec<u8>) -> CResult<()>
fn set(&mut self, key: &[u8], value: Vec<u8>) -> CResult<()>
Sets a value for a key, replacing the existing value if any.
source§fn scan_prefix(&mut self, prefix: &[u8]) -> Self::ScanIterator<'_>where
Self: Sized,
fn scan_prefix(&mut self, prefix: &[u8]) -> Self::ScanIterator<'_>where
Self: Sized,
Iterates over all key/value pairs starting with prefix.
Auto Trait Implementations§
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
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