pub struct EmbeddingVector { /* private fields */ }Expand description
Wrapper type around an immutable floating-point embedding.
Implementations§
Source§impl EmbeddingVector
impl EmbeddingVector
Sourcepub fn new(values: Vec<f32>) -> MemoryResult<Self>
pub fn new(values: Vec<f32>) -> MemoryResult<Self>
Creates a new embedding from owned values.
§Errors
Returns MemoryError::InvalidRecord when the supplied vector is empty
or contains non-finite values.
Sourcepub fn from_slice(values: &[f32]) -> MemoryResult<Self>
pub fn from_slice(values: &[f32]) -> MemoryResult<Self>
Creates an embedding by copying the provided slice.
§Errors
Returns MemoryError::InvalidRecord if the slice is empty or contains
non-finite values.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether the embedding is empty. This should never be the case
because EmbeddingVector::new rejects empty inputs, but the helper is
provided for completeness.
Trait Implementations§
Source§impl Clone for EmbeddingVector
impl Clone for EmbeddingVector
Source§fn clone(&self) -> EmbeddingVector
fn clone(&self) -> EmbeddingVector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingVector
impl Debug for EmbeddingVector
Source§impl<'de> Deserialize<'de> for EmbeddingVector
impl<'de> Deserialize<'de> for EmbeddingVector
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
Source§impl PartialEq for EmbeddingVector
impl PartialEq for EmbeddingVector
Source§impl Serialize for EmbeddingVector
impl Serialize for EmbeddingVector
impl StructuralPartialEq for EmbeddingVector
Auto Trait Implementations§
impl Freeze for EmbeddingVector
impl RefUnwindSafe for EmbeddingVector
impl Send for EmbeddingVector
impl Sync for EmbeddingVector
impl Unpin for EmbeddingVector
impl UnwindSafe for EmbeddingVector
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