pub enum Value {
Show 15 variants
Null,
Bool(bool),
Int(i64),
Float(f64),
String(Arc<str>),
List(Arc<Vec<Value>>),
Map(Arc<BTreeMap<String, Value>>),
Node(Arc<Node>),
Relationship(Arc<Relationship>),
Path(Arc<Path>),
Temporal(Temporal),
Point(PointValue),
Uuid(u128),
Vector {
coord: VectorCoordKind,
values: Arc<Vec<Value>>,
},
Bytes(Arc<[u8]>),
}Expand description
OpenCypher runtime value.
Variants§
Null
Bool(bool)
Int(i64)
Float(f64)
String(Arc<str>)
List(Arc<Vec<Value>>)
Map(Arc<BTreeMap<String, Value>>)
Node(Arc<Node>)
Relationship(Arc<Relationship>)
Path(Arc<Path>)
Temporal(Temporal)
Point(PointValue)
Uuid(u128)
CIP-246 UUID: 128-bit value, rendered as the canonical lowercase
hyphenated string (to_display_string/iso-style bare form) and
constructible from a string or two 64-bit halves.
Vector
Bytes(Arc<[u8]>)
A byte array (ADR-0327). Statement-scoped: it enters only as a query
parameter (Bolt PackStream Bytes) and flows through expressions,
lists and maps into results; storing it as a property fails with a
typed TypeError. Shared payload like String (ADR-0170).
Implementations§
Source§impl Value
impl Value
Sourcepub fn depth_within(&self, limit: u32) -> bool
pub fn depth_within(&self, limit: u32) -> bool
Whether every container in this value nests at most limit levels
deep (ADR-0462). Iterative over an explicit worklist — never
recursive — so an over-deep value is rejected without first growing
the stack to its depth.
A scalar has depth 0; a container’s own level is one more than its
parent’s, so [] is depth 1 and [[]] depth 2. Node, relationship
and path values count as containers, and their property values nest
inside them.
Sourcepub fn check_depth(&self) -> Result<()>
pub fn check_depth(&self) -> Result<()>
The typed depth guard: Ok when this value nests at most
MAX_VALUE_DEPTH levels (ADR-0462), else a ValueDepthExceeded
execution error. The Kind: prefix is the token the error channel
classifies (ErrorKind::ValueDepthExceeded).
Sourcepub fn depth(&self) -> u32
pub fn depth(&self) -> u32
This value’s exact container depth (scalar 0, [] 1, [[]] 2),
walked iteratively once. For a value whose depth is already known,
Value::checked_list_with_depth avoids this walk.
The walk memoizes container payloads by identity: a shared subtree is
measured once, so the cost is linear in distinct payloads, never in
the expanded node count of a fan-out DAG (a [acc, acc] chain would
otherwise expand exponentially). A walk that exceeds
[MAX_DEPTH_WALK_STEPS] conservatively answers u32::MAX (over any
cap), so it can refuse but never hang.
Sourcepub fn checked_list(values: Vec<Value>) -> Result<Value>
pub fn checked_list(values: Vec<Value>) -> Result<Value>
Build a list value, rejecting one that would nest deeper than
MAX_VALUE_DEPTH (ADR-0462). The one constructor for a list the
evaluator builds from dynamic expression results.
Sourcepub fn checked_map(values: BTreeMap<String, Value>) -> Result<Value>
pub fn checked_map(values: BTreeMap<String, Value>) -> Result<Value>
Build a map value, rejecting one that would nest deeper than
MAX_VALUE_DEPTH (ADR-0462). The one constructor for a map the
evaluator builds from dynamic expression results.
Source§impl Value
impl Value
Sourcepub fn to_json_tagged(&self) -> Value
pub fn to_json_tagged(&self) -> Value
The tagged {"t":..., "v":...} JSON form. Built from the canonical
serde::Serialize impl (via [TaggedRef]), so the tree here and the
direct WAL/checkpoint bytes cannot diverge. Graph entities are not
persistence properties: the encoder rejects them (see [TaggedRef]),
and that internal error maps to Null here.
pub fn from_json_tagged(v: &Value) -> Result<Value>
Sourcepub fn to_json_plain(&self) -> Value
pub fn to_json_plain(&self) -> Value
Best-effort Python/JSON-ish value for FFI clients.
pub fn from_json_plain(v: &Value) -> Value
Sourcepub fn from_json_scalars(v: &Value) -> Value
pub fn from_json_scalars(v: &Value) -> Value
Decode JSON whose objects are always maps. A _type of node,
point, or vector stays a string property. This is the decoder for
untrusted property documents. [from_json_plain] is the inverse of
[to_json_plain] and still recognizes those tags.
Source§impl Value
impl Value
Sourcepub fn cypher_eq(&self, other: &Value) -> Value
pub fn cypher_eq(&self, other: &Value) -> Value
Cypher equality: numbers compare across int/float; null = x is null.
Lists and maps are three-valued: any false pair yields false; otherwise
any null pair yields null.
pub fn eq_non_null(&self, other: &Value) -> bool
Sourcepub fn compare(&self, other: &Value) -> Option<Ordering>
pub fn compare(&self, other: &Value) -> Option<Ordering>
Cypher’s three-valued ordering over one type-pair (None = null: the
pair is incomparable, or a null operand reached here). Orderable:
numbers, strings, bytes, booleans, lists, maps, and the temporal kinds
except durations. Not orderable despite having =: UUIDs, points,
durations, and any cross-type pair — the <=/>= arms of the
comparison operators still hold for equal operands (cmp_bool).
Sourcepub fn order_by_cmp(&self, other: &Value) -> Ordering
pub fn order_by_cmp(&self, other: &Value) -> Ordering
Total order for ORDER BY / min / max. Comparison operators still use
compare, which is three-valued and incomparable across types.
Source§impl Value
impl Value
Sourcepub fn from_relationship(rel: Relationship) -> Self
pub fn from_relationship(rel: Relationship) -> Self
Share one relationship across every row that clones this value.
Sourcepub fn logical_bytes(&self) -> u64
pub fn logical_bytes(&self) -> u64
Documented logical payload size (ADR-0042) — the per-variant
accumulation of the sizes str_logical_bytes spells for
strings.
pub fn as_temporal(&self) -> Option<&Temporal>
pub fn as_string(&self) -> Option<&str>
pub fn is_null(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_number(&self) -> Option<f64>
pub fn as_int(&self) -> Option<i64>
pub fn to_cypher_literal(&self) -> String
Sourcepub fn to_display_string(&self) -> String
pub fn to_display_string(&self) -> String
The CIP-271 toString() rendering: the cypher-shell display form
rather than the round-trippable literal form — strings are unquoted,
temporals are bare full-precision ISO strings (ADR-0448), and
maps/lists render recursively with , separators (verified
against Neo4j 2026.09.0).