Skip to main content

VectorIndexFactory

Trait VectorIndexFactory 

Source
pub trait VectorIndexFactory: Send + Sync {
    type Index: VectorIndex;

    // Required methods
    fn create(&self, dim: usize) -> Result<Self::Index>;
    fn load(&self, path: &Path) -> Result<Self::Index>;
}
Expand description

Separates “create a fresh index” from “load existing index from disk.” The factory holds the configuration (HNSW M, efConstruction, etc.) that is otherwise duplicated between the two operations.

Required Associated Types§

Required Methods§

Source

fn create(&self, dim: usize) -> Result<Self::Index>

Create a new empty index with the given vector dimension.

Source

fn load(&self, path: &Path) -> Result<Self::Index>

Load an existing index from disk. Validates internal invariants on load.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§