pub struct MemoryIndex { /* private fields */ }Expand description
In-memory index of memory entries.
Implementations§
Source§impl MemoryIndex
impl MemoryIndex
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn insert(&mut self, entry: MemoryEntry) -> MemoryResult<()>
pub fn insert(&mut self, entry: MemoryEntry) -> MemoryResult<()>
Insert an entry. Returns error if id already exists.
Sourcepub fn get(&self, id: &str) -> MemoryResult<&MemoryEntry>
pub fn get(&self, id: &str) -> MemoryResult<&MemoryEntry>
Get an entry by id.
Sourcepub fn remove(&mut self, id: &str) -> MemoryResult<MemoryEntry>
pub fn remove(&mut self, id: &str) -> MemoryResult<MemoryEntry>
Remove an entry by id.
Sourcepub fn entries_mut(&mut self) -> &mut HashMap<String, MemoryEntry>
pub fn entries_mut(&mut self) -> &mut HashMap<String, MemoryEntry>
Mutable access to all entries (used by compaction).
Sourcepub fn query(&self, q: &IndexQuery) -> IndexResult
pub fn query(&self, q: &IndexQuery) -> IndexResult
Query the index with filters. Results sorted newest-first.
Trait Implementations§
Source§impl Clone for MemoryIndex
impl Clone for MemoryIndex
Source§fn clone(&self) -> MemoryIndex
fn clone(&self) -> MemoryIndex
Returns a duplicate of the value. Read more
1.0.0 · 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 MemoryIndex
impl Debug for MemoryIndex
Source§impl Default for MemoryIndex
impl Default for MemoryIndex
Source§impl<'de> Deserialize<'de> for MemoryIndex
impl<'de> Deserialize<'de> for MemoryIndex
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 Freeze for MemoryIndex
impl RefUnwindSafe for MemoryIndex
impl Send for MemoryIndex
impl Sync for MemoryIndex
impl Unpin for MemoryIndex
impl UnsafeUnpin for MemoryIndex
impl UnwindSafe for MemoryIndex
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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