#[non_exhaustive]pub enum Value {
}Expand description
Dynamic value type for properties, parameters, and results.
Preserves the distinction between integers and floats, and includes graph-specific variants for nodes, edges, paths, and vectors.
Note: Eq and Hash are implemented manually to support using Value as
HashMap keys. Floats are compared/hashed by their bit representation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
JSON/Cypher null.
Bool(bool)
Boolean value.
Int(i64)
64-bit signed integer.
Float(f64)
64-bit floating-point number.
String(String)
UTF-8 string.
Bytes(Vec<u8>)
Raw byte buffer.
List(Vec<Value>)
Ordered list of values.
Map(HashMap<String, Value>)
String-keyed map of values.
Node(Node)
Graph node with VID, label, and properties.
Edge(Edge)
Graph edge with EID, type, endpoints, and properties.
Path(Path)
Graph path (alternating nodes and edges).
Vector(Vec<f32>)
Dense float vector for similarity search.
Temporal(TemporalValue)
Typed temporal value (date, time, datetime, duration).
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_u64(&self) -> Option<u64>
pub fn as_u64(&self) -> Option<u64>
Returns the integer as u64 if this is a non-negative Int, otherwise None.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns a float, coercing Int to f64 if needed.
Returns None for non-numeric variants.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the string slice if this is String, otherwise None.
Sourcepub fn as_array(&self) -> Option<&Vec<Value>>
pub fn as_array(&self) -> Option<&Vec<Value>>
Returns the list if this is List, otherwise None.
Sourcepub fn as_object(&self) -> Option<&HashMap<String, Value>>
pub fn as_object(&self) -> Option<&HashMap<String, Value>>
Returns the map if this is Map, otherwise None.
Sourcepub fn get(&self, key: &str) -> Option<&Value>
pub fn get(&self, key: &str) -> Option<&Value>
Gets a value by key if this is a Map.
Returns None if not a map or key doesn’t exist.
Sourcepub fn is_temporal(&self) -> bool
pub fn is_temporal(&self) -> bool
Returns true if this is a Temporal value.
Sourcepub fn as_temporal(&self) -> Option<&TemporalValue>
pub fn as_temporal(&self) -> Option<&TemporalValue>
Returns the temporal value reference if this is Temporal, otherwise None.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.