pub enum VectorCoordKind {
Int8,
Int16,
Int32,
Int64,
Float16,
BFloat16,
Float32,
Float64,
}Expand description
A vector coordinate type (CIP-216/CIP-200): the numeric types valid
inside VECTOR<...>/VECTOR(...). Int64/Float64 double as ordinary
plain property types (aliases for INTEGER/FLOAT) outside a vector
type; the others (Float16, BFloat16, Float32, Int8/Int16/
Int32) are valid only as a vector coordinate type. Lives in
relate-model (rather than the parser, where it originated) so the
runtime CypherValue::Vector variant can carry it without a circular
crate dependency – the parser re-exports this same type as
relate_parser::VectorCoordKind.
Variants§
Int8
Int16
Int32
Int64
Float16
IEEE-754 binary16: 10 mantissa bits, range ±65504.
BFloat16
bfloat16: the top 16 bits of an IEEE-754 binary32 (8 exponent bits, 7 mantissa bits), so its range matches FLOAT32’s at lower precision.
Float32
Float64
Implementations§
Source§impl VectorCoordKind
impl VectorCoordKind
Sourcepub fn canonical_name(&self) -> &'static str
pub fn canonical_name(&self) -> &'static str
CIP-100 “Default type names” table, vector coordinate half: the
canonical coordinate name rendered inside VECTOR<...> and by
toString/Display. Int64/Float64 render as the plain
INTEGER/FLOAT names (CIP-216 S-6: they double as ordinary
property type aliases), not INTEGER64/FLOAT64.
Sourcepub fn from_canonical_name(name: &str) -> Option<Self>
pub fn from_canonical_name(name: &str) -> Option<Self>
Reverse of canonical_name, understanding only the canonical
(non-aliased) spelling – used to round-trip a rendered type string.
Sourcepub fn from_alias(name: &str) -> Option<Self>
pub fn from_alias(name: &str) -> Option<Self>
Resolves the full CIP-200 alias vocabulary accepted by the vector()
constructor’s coordinateType keyword argument (case-sensitive,
already-uppercased input expected): every alias in the “Type Name
Normalization” table, not just the canonical spelling.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Whether this coordinate kind stores its elements as CypherValue::Int
(the four integer-family kinds) vs CypherValue::Float (the two
floating-point kinds).
Sourcepub fn order_rank(&self) -> u8
pub fn order_rank(&self) -> u8
The CIP-200 “Ordering of the Vector Type” coordinate-type rank:
INTEGER8 < INTEGER16 < INTEGER32 < INTEGER64 < BFLOAT16 < FLOAT16 <
FLOAT32 < FLOAT64 (Neo4j’s CypherTypeOrder: BFLOAT16 precedes
FLOAT16).
Sourcepub fn narrow_float(self, f: f64) -> Option<f64>
pub fn narrow_float(self, f: f64) -> Option<f64>
Narrows a finite f64 to this kind’s floating precision
(round-to-nearest-even) and returns it widened again — the one
conversion shared by vector() construction, the JSON exactness
check and JSON decoding. None when the input is not finite or the
narrowing overflows the kind’s range. Integer kinds always return
None: their coordinates are integers, converted by their own path.
Sourcepub fn is_exact(self, f: f64) -> bool
pub fn is_exact(self, f: f64) -> bool
Whether f survives this kind’s narrowing unchanged: the one
exactness rule a stored coordinate must satisfy — it spells exactly
the value the kind holds, not a rounded one. Self::narrow_float
is the conversion behind it, so the JSON codec and every surface’s
“can this value be written as this coordinate type” guard share one
predicate; float32_exact is this rule’s FLOAT32 case. Always
false for the integer kinds: their coordinates are integers,
converted by their own path.
Sourcepub fn holds_int(self, n: i64) -> bool
pub fn holds_int(self, n: i64) -> bool
Whether the integer n is a coordinate this kind holds — within
the kind’s two’s-complement width: the integer half of
Self::is_exact, the one width predicate the JSON codec and every
surface’s integer-coordinate guard share. Always false for the
floating kinds: their coordinates are floats.
Source§impl VectorCoordKind
impl VectorCoordKind
Sourcepub fn coordinate_tokens(text: &str) -> Option<Vec<VectorCoordToken>>
pub fn coordinate_tokens(text: &str) -> Option<Vec<VectorCoordToken>>
The bracketed coordinate-list spelling the vector() string
constructor accepts ("[1, 2, 3]"), token by token: None when the
text lacks its brackets. The one tokenizer the executor’s construction
and the front end’s compile-time check share; each layers its own
policy on the classification (the executor rejects every non-number,
the front end only VectorCoordToken::Malformed, leaving
VectorCoordToken::NonNumeric to the runtime type error).
Trait Implementations§
Source§impl Clone for VectorCoordKind
impl Clone for VectorCoordKind
impl Copy for VectorCoordKind
Source§impl Debug for VectorCoordKind
impl Debug for VectorCoordKind
impl Eq for VectorCoordKind
Source§impl Hash for VectorCoordKind
impl Hash for VectorCoordKind
Source§impl PartialEq for VectorCoordKind
impl PartialEq for VectorCoordKind
impl StructuralPartialEq for VectorCoordKind
Auto Trait Implementations§
impl Forget for VectorCoordKind
impl Freeze for VectorCoordKind
impl Move for VectorCoordKind
impl RefUnwindSafe for VectorCoordKind
impl Send for VectorCoordKind
impl Sync for VectorCoordKind
impl Unpin for VectorCoordKind
impl UnsafeUnpin for VectorCoordKind
impl UnwindSafe for VectorCoordKind
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.