Trait VectorOperations

Source
pub trait VectorOperations<T> {
    // Required methods
    fn get_vector(&self) -> Vec<f32>;
    fn get_data(&self) -> &T;
    fn get_data_type(&self) -> DataType;
    fn overwrite_vector(&mut self, vector: Vec<f32>);

    // Provided method
    fn get_dimensionality(&self) -> usize { ... }
}
Expand description

Shared behaviors between Vector types. This trait defines the common operations that can be performed on vectorized data regardless of the underlying data type.

Required Methods§

Source

fn get_vector(&self) -> Vec<f32>

Get the vector representation of the data

Returns a clone of the internal vector of f32 values

Source

fn get_data(&self) -> &T

Get a reference to the original data

Returns an immutable reference to the stored data

Source

fn get_data_type(&self) -> DataType

Get the type of data stored

Returns the DataType enum indicating what kind of data is vectorized

Source

fn overwrite_vector(&mut self, vector: Vec<f32>)

Write a new vector to the vector field

§Arguments
  • vector - The new vector to replace the existing one

Provided Methods§

Source

fn get_dimensionality(&self) -> usize

Get dimensionality of the vector

Returns the length of the vector representation

Implementors§