pub trait VectorOperator {
// Required methods
fn next(&mut self) -> Result<Option<VectorMatch>, VectorError>;
fn dimension(&self) -> usize;
// Provided method
fn collect_all(&mut self) -> Result<Vec<VectorMatch>, VectorError> { ... }
}Expand description
Trait for vector search operators.
Operators implement an iterator-like interface for streaming vector search
results. Unlike standard iterators, the next method returns a Result
to handle storage or computation errors.
Required Methods§
Sourcefn next(&mut self) -> Result<Option<VectorMatch>, VectorError>
fn next(&mut self) -> Result<Option<VectorMatch>, VectorError>
Get the next match from the operator.
Returns Ok(Some(match)) if a match is available, Ok(None) if the
operator is exhausted, or Err if an error occurred.
Provided Methods§
Sourcefn collect_all(&mut self) -> Result<Vec<VectorMatch>, VectorError>
fn collect_all(&mut self) -> Result<Vec<VectorMatch>, VectorError>
Collect all remaining matches into a vector.
This consumes the operator and returns all matches.