pub struct InMemoryBackend;
Expand description
An in-memory backend that doesn’t persist data.
This backend is useful for testing or when persistence is not needed.
Implementations§
Trait Implementations§
Source§impl Debug for InMemoryBackend
impl Debug for InMemoryBackend
Source§impl Default for InMemoryBackend
impl Default for InMemoryBackend
Source§fn default() -> InMemoryBackend
fn default() -> InMemoryBackend
Returns the “default value” for a type. Read more
Source§impl<K, V> StorageBackend<K, V> for InMemoryBackend
impl<K, V> StorageBackend<K, V> for InMemoryBackend
Source§fn load_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, V>, PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, V>, PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load all key-value pairs from the storage backend. Read more
Source§fn save<'life0, 'async_trait>(
&'life0 self,
_key: K,
_value: V,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
_key: K,
_value: V,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Save a key-value pair to the storage backend. Read more
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a key-value pair from the storage backend. Read more
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), PersistentError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Flush any buffered writes to the storage backend. Read more
Source§fn contains_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool, PersistentError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains_key<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool, PersistentError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a key exists in the storage backend. Read more
Auto Trait Implementations§
impl Freeze for InMemoryBackend
impl RefUnwindSafe for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl UnwindSafe for InMemoryBackend
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