VectorStore

Trait VectorStore 

Source
pub trait VectorStore<K: U64 = u64, V: Serialize + DeserializeOwned + Clone = Properties>: Clone {
Show 13 methods // Required methods fn new(name: Option<&str>) -> Self; fn len(&self) -> u64; fn is_empty(&self) -> bool; fn push(&mut self, id: K, value: V); fn has(&self, key: K) -> bool; fn get(&self, key: K) -> Option<&(K, V)>; fn get_mut(&mut self, key: K) -> Option<&mut (K, V)>; fn get_index(&self, index: u64) -> Option<&(K, V)>; fn get_index_mut(&mut self, index: u64) -> Option<&mut (K, V)>; fn sort(&mut self); fn iter<'a>(&'a self) -> impl Iterator<Item = &'a (K, V)> where K: 'a, V: 'a; fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut (K, V)> where K: 'a, V: 'a; // Provided method fn cleanup(&mut self) { ... }
}
Expand description

Represents a Vector store

Required Methods§

Source

fn new(name: Option<&str>) -> Self

Create a new Vector store

Source

fn len(&self) -> u64

The length of the store

Source

fn is_empty(&self) -> bool

Check if the store is empty

Source

fn push(&mut self, id: K, value: V)

Push a value into the store

Source

fn has(&self, key: K) -> bool

has a key in the store

Source

fn get(&self, key: K) -> Option<&(K, V)>

get a value from the store

Source

fn get_mut(&mut self, key: K) -> Option<&mut (K, V)>

get a mutable value from the store

Source

fn get_index(&self, index: u64) -> Option<&(K, V)>

get a value from the store

Source

fn get_index_mut(&mut self, index: u64) -> Option<&mut (K, V)>

get a mutable value from the store

Source

fn sort(&mut self)

Sort the store

Source

fn iter<'a>(&'a self) -> impl Iterator<Item = &'a (K, V)>
where K: 'a, V: 'a,

Iterate over the store

Source

fn iter_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut (K, V)>
where K: 'a, V: 'a,

Iterate mutably over the store

Provided Methods§

Source

fn cleanup(&mut self)

Cleanup the store

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§