pub struct Vector {
pub dtype: EmbeddingType,
pub dim: u16,
pub data: Vec<u8>,
}Fields§
§dtype: EmbeddingType§dim: u16§data: Vec<u8>Implementations§
Source§impl Vector
impl Vector
pub fn new(dtype: EmbeddingType, dim: u16, data: Vec<u8>) -> Self
pub fn from_f32(data: Vec<f32>) -> Self
pub fn as_f32(&self) -> Result<Vec<f32>, String>
pub fn normalize(&self) -> Result<Vector, String>
pub fn similarity( &self, other: &Vector, metric: SimilarityMetric, ) -> Result<f32, String>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vector
impl<'de> Deserialize<'de> for Vector
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Vector
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl Freeze for Vector
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnwindSafe for Vector
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)