Struct CanonicalVector
pub struct CanonicalVector { /* private fields */ }Expand description
Freshness policy and commit token types used by projected queries. A validated, dimension-checked vector of f32 values in canonical form.
Stored as authoritative entity state. Dimension is fixed at construction
and matches the contract-declared VectorDimension.
§Canonical form
Every construction path (constructor and canonical decoder) enforces one
canonical form: all components are finite, and negative zero is
canonicalized to positive zero. Within that domain IEEE f32 equality,
bitwise comparison, and bitwise hashing all agree, so the derived
PartialEq, the bitwise Hash/Ord below, and the durable canonical
digest are mutually consistent (a == b implies digest(a) == digest(b)).
This discipline is what makes vectors a safe exception to the
no-business-floats rule in this crate.
Implementations§
§impl CanonicalVector
impl CanonicalVector
pub fn new(
components: Vec<f32>,
) -> Result<CanonicalVector, CanonicalVectorError>
pub fn new( components: Vec<f32>, ) -> Result<CanonicalVector, CanonicalVectorError>
Creates a vector from components, enforcing canonical form.
Rejects an empty or over-MAX_VECTOR_DIMENSION component list and any
NaN or infinite component as typed errors; canonicalizes -0.0 to
+0.0.
pub fn components(&self) -> &[f32]
pub fn components(&self) -> &[f32]
The raw f32 components.
pub fn into_components(self) -> Vec<f32>
pub fn into_components(self) -> Vec<f32>
Consumes self and returns the owned components.
Trait Implementations§
§impl Clone for CanonicalVector
impl Clone for CanonicalVector
§fn clone(&self) -> CanonicalVector
fn clone(&self) -> CanonicalVector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CanonicalVector
impl Debug for CanonicalVector
impl Eq for CanonicalVector
§impl Hash for CanonicalVector
impl Hash for CanonicalVector
§impl Ord for CanonicalVector
impl Ord for CanonicalVector
§fn cmp(&self, other: &CanonicalVector) -> Ordering
fn cmp(&self, other: &CanonicalVector) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for CanonicalVector
impl PartialEq for CanonicalVector
§impl PartialOrd for CanonicalVector
impl PartialOrd for CanonicalVector
impl StructuralPartialEq for CanonicalVector
Auto Trait Implementations§
impl Freeze for CanonicalVector
impl RefUnwindSafe for CanonicalVector
impl Send for CanonicalVector
impl Sync for CanonicalVector
impl Unpin for CanonicalVector
impl UnsafeUnpin for CanonicalVector
impl UnwindSafe for CanonicalVector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].