#[non_exhaustive]pub enum VectorOperandKind {
Float,
Bit,
Sparse,
}Expand description
The operand type a vector-distance comparison is made in (#959).
The cast is load-bearing on the binary side: '1011'::bit is bit(1), so a
length-less cast silently keeps the first bit and reports the distance
between two one-bit values. varbit carries whatever width the value has,
which makes a width disagreement different bit lengths 8 and 4 from the
server rather than a plausible wrong answer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Float
Float vector: '[…]'::vector, ordered by <=> / <-> / <#>.
Bit
Binary vector: '1011'::varbit, ordered by <~> / <%>.
Sparse
Sparse float vector: '{1:0.5,7:0.25}/1000'::sparsevec, same operators
as Self::Float (#959).
A sparse literal has no other reading: '{1:1}/5'::vector is
Vector contents must start with "[", so this kind is the difference
between a query and an error.
Implementations§
Source§impl VectorOperandKind
impl VectorOperandKind
Sourcepub const fn cast(self) -> &'static str
pub const fn cast(self) -> &'static str
The pgvector type a literal of this kind is cast to.
varbit and not bit for the binary kind — see the type’s own note.
There is deliberately no half-precision kind: a halfvec column
compared against '[…]'::vector resolves the literal to halfvec and
uses the same halfvec_*_ops index — verified on the rig, where both
spellings produce the identical plan. A kind that changes nothing the
server can see would be a distinction the code carries and the database
ignores.
Trait Implementations§
Source§impl Clone for VectorOperandKind
impl Clone for VectorOperandKind
Source§fn clone(&self) -> VectorOperandKind
fn clone(&self) -> VectorOperandKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for VectorOperandKind
Source§impl Debug for VectorOperandKind
impl Debug for VectorOperandKind
Source§impl Default for VectorOperandKind
impl Default for VectorOperandKind
Source§fn default() -> VectorOperandKind
fn default() -> VectorOperandKind
Source§impl<'de> Deserialize<'de> for VectorOperandKind
impl<'de> Deserialize<'de> for VectorOperandKind
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VectorOperandKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VectorOperandKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for VectorOperandKind
Source§impl PartialEq for VectorOperandKind
impl PartialEq for VectorOperandKind
Source§impl Serialize for VectorOperandKind
impl Serialize for VectorOperandKind
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for VectorOperandKind
Auto Trait Implementations§
impl Freeze for VectorOperandKind
impl RefUnwindSafe for VectorOperandKind
impl Send for VectorOperandKind
impl Sync for VectorOperandKind
impl Unpin for VectorOperandKind
impl UnsafeUnpin for VectorOperandKind
impl UnwindSafe for VectorOperandKind
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.