pub struct MemoryStore { /* private fields */ }Expand description
Append-and-update key-value memory store.
Implementations§
Source§impl MemoryStore
impl MemoryStore
pub fn new() -> Self
Sourcepub fn store(&mut self, key: &str, value: Value, tags: &[&str])
pub fn store(&mut self, key: &str, value: Value, tags: &[&str])
Store value under key. Overwrites any existing entry.
Sourcepub fn get(&mut self, key: &str) -> Option<&MemoryEntry>
pub fn get(&mut self, key: &str) -> Option<&MemoryEntry>
Get an entry by key, updating its access metadata.
Sourcepub fn peek(&self, key: &str) -> Option<&MemoryEntry>
pub fn peek(&self, key: &str) -> Option<&MemoryEntry>
Get an entry by key without updating access metadata.
Sourcepub fn all(&self) -> Vec<&MemoryEntry>
pub fn all(&self) -> Vec<&MemoryEntry>
All entries, sorted by key.
Sourcepub fn by_tag(&self, tag: &str) -> Vec<&MemoryEntry>
pub fn by_tag(&self, tag: &str) -> Vec<&MemoryEntry>
Entries matching a specific tag.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§fn clone(&self) -> MemoryStore
fn clone(&self) -> MemoryStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
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