pub struct MemoryStore { /* private fields */ }Expand description
Durable, screened memory store.
Implementations§
Source§impl MemoryStore
impl MemoryStore
pub fn new() -> Self
Sourcepub fn write(
&mut self,
candidate: NewMemory,
) -> Result<&MemoryRecord, WriteRejection>
pub fn write( &mut self, candidate: NewMemory, ) -> Result<&MemoryRecord, WriteRejection>
Screen and insert a new memory. Rejects duplicates and anything that
fails screening::screen; both are reported, never silently
dropped, so a UI can tell the user why a candidate wasn’t saved.
Sourcepub fn delete(&mut self, id: &str) -> Option<MemoryRecord>
pub fn delete(&mut self, id: &str) -> Option<MemoryRecord>
Explicit user delete. Always allowed, including for pinned rows – pinning protects a memory from automatic eviction, not from the user deliberately removing it.
pub fn get(&self, id: &str) -> Option<&MemoryRecord>
pub fn set_pinned(&mut self, id: &str, pinned: bool) -> bool
pub fn record_access(&mut self, id: &str)
Sourcepub fn list(&self, scope: Option<&str>) -> Vec<&MemoryRecord>
pub fn list(&self, scope: Option<&str>) -> Vec<&MemoryRecord>
All records in a scope (or every record when scope is None),
unordered (callers rank).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§impl<'de> Deserialize<'de> for MemoryStore
impl<'de> Deserialize<'de> for MemoryStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for MemoryStore
impl Freeze for MemoryStore
impl Move 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more