pub struct MemoryStorage { /* private fields */ }Expand description
In-memory storage backend for testing and ephemeral state.
State is lost when the process exits. Useful for:
- Unit testing widget persistence logic
- Applications that don’t need cross-session persistence
- Development/debugging without file I/O
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub fn with_entries(entries: HashMap<String, StoredEntry>) -> Self
pub fn with_entries(entries: HashMap<String, StoredEntry>) -> Self
Create memory storage pre-populated with entries.
Trait Implementations§
Source§impl Debug for MemoryStorage
impl Debug for MemoryStorage
Source§impl Default for MemoryStorage
impl Default for MemoryStorage
Source§fn default() -> MemoryStorage
fn default() -> MemoryStorage
Returns the “default value” for a type. Read more
Source§impl StorageBackend for MemoryStorage
impl StorageBackend for MemoryStorage
Source§fn load_all(&self) -> StorageResult<HashMap<String, StoredEntry>>
fn load_all(&self) -> StorageResult<HashMap<String, StoredEntry>>
Load all stored state entries. Read more
Source§fn save_all(&self, entries: &HashMap<String, StoredEntry>) -> StorageResult<()>
fn save_all(&self, entries: &HashMap<String, StoredEntry>) -> StorageResult<()>
Save all state entries atomically. Read more
Source§fn clear(&self) -> StorageResult<()>
fn clear(&self) -> StorageResult<()>
Clear all stored state.
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Check if the backend is available and functional.
Auto Trait Implementations§
impl !Freeze for MemoryStorage
impl RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl UnsafeUnpin for MemoryStorage
impl UnwindSafe for MemoryStorage
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