pub struct VectorIndex { /* private fields */ }Expand description
Thread-safe handle to a vector index.
Implementations§
Source§impl VectorIndex
impl VectorIndex
Sourcepub fn new(config: VectorIndexConfig) -> Result<Self, MemoryError>
pub fn new(config: VectorIndexConfig) -> Result<Self, MemoryError>
Construct a new index from a config. Dispatches to the active backend (selected at compile time via feature flag).
Sourcepub fn load(
dir: &Path,
basename: &str,
config: VectorIndexConfig,
) -> Result<Self, MemoryError>
pub fn load( dir: &Path, basename: &str, config: VectorIndexConfig, ) -> Result<Self, MemoryError>
Load a previously saved index. Dispatches to the active backend.
pub fn insert(&self, key: String, vector: &[f32]) -> Result<(), MemoryError>
pub fn delete(&self, key: &str) -> Result<(), MemoryError>
pub fn update(&self, key: String, vector: &[f32]) -> Result<(), MemoryError>
pub fn search( &self, query: &[f32], top_k: usize, ) -> Result<Vec<VectorHit>, MemoryError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn save(&self, dir: &Path, basename: &str) -> Result<(), MemoryError>
pub fn backend_name(&self) -> &'static str
Sourcepub fn _placeholder(&self)
pub fn _placeholder(&self)
Note: downcasting to a concrete backend type is not supported
through the trait. Tests that need backend-specific introspection
should use the backend_name() method or read the sidecar
manifest. This is intentional — keeping the trait free of Any
avoids the vtable overhead and keeps the public surface minimal.
Trait Implementations§
Source§impl Clone for VectorIndex
impl Clone for VectorIndex
Source§fn clone(&self) -> VectorIndex
fn clone(&self) -> VectorIndex
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 moreAuto Trait Implementations§
impl Freeze for VectorIndex
impl !RefUnwindSafe for VectorIndex
impl Send for VectorIndex
impl Sync for VectorIndex
impl Unpin for VectorIndex
impl UnsafeUnpin for VectorIndex
impl !UnwindSafe for VectorIndex
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