Skip to main content

VectorCoordKind

Enum VectorCoordKind 

Source
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

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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

Source

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).

Source

pub fn parse_coordinates(text: &str) -> Option<Vec<f64>>

Parse the bracketed coordinate-list spelling ("[1, 2, 3]") to its numbers: None when the text lacks its brackets or any token is not a number.

Trait Implementations§

Source§

impl Clone for VectorCoordKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for VectorCoordKind

Source§

impl Debug for VectorCoordKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for VectorCoordKind

Source§

impl Hash for VectorCoordKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VectorCoordKind

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VectorCoordKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.