Skip to main content

Value

Enum Value 

Source
pub enum Value {
    Int(i64),
    Float(f64),
    Str(String),
    Bool(bool),
    List(Vec<Value>),
    Map(BTreeMap<String, Value>),
    Date(i32),
    LocalDateTime(i64),
    DateTime {
        micros_utc: i64,
        offset_seconds: i32,
    },
    Duration {
        months: i32,
        days: i32,
        nanos: i64,
    },
    Binary(Vec<u8>),
    Null,
}
Expand description

A property or query value.

§Serde tags are a storage format

bincode encodes a variant by its declaration index, and the WAL, the mixed-column blob and snapshots all store Value that way. A variant is therefore only ever added, never reordered or removed, and a new storable variant goes before Null, which is always last. The index of every variant is pinned by types::tests::value_serde_tags_are_pinned; changing it means changing that test deliberately.

Variants§

§

Int(i64)

§

Float(f64)

§

Str(String)

§

Bool(bool)

§

List(Vec<Value>)

§

Map(BTreeMap<String, Value>)

Nested key-value map. Spills to the Mixed column path like List. Never promotes a homogeneous typed column. Not fulltext-indexed.

§

Date(i32)

Calendar date: days since 1970-01-01. JSON form {"$date": "2024-01-15"}.

§

LocalDateTime(i64)

Date and time with no time zone: microseconds since 1970-01-01T00:00:00. JSON form {"$ldt": "2024-01-15T12:34:56.789012"}.

§

DateTime

An instant plus the UTC offset it was written with. The offset is kept so the value prints back as written; equality and ordering in queries and in index keys use micros_utc only. A valid offset is within ±18:00 (MAX_OFFSET_SECONDS). JSON form {"$dt": "2024-01-15T12:34:56.789012+05:30"}.

Fields

§micros_utc: i64
§offset_seconds: i32
§

Duration

openCypher duration: months, days and nanoseconds are independent and never normalized against each other (a month is not 30 days). Not totally ordered. JSON form {"$dur": "P1Y2M3DT4H5M6.789S"}.

Fields

§months: i32
§days: i32
§nanos: i64
§

Binary(Vec<u8>)

Byte blob, no encoding assumed. JSON form {"$binary": "<base64>"}.

§

Null

Null as an element of a list or a value of a map, produced only by query evaluation ([1, null], {a: n.missing}). A top-level query null is still Option<Value>::None.

Query-only: it is never stored. The write path refuses a property value that holds one, and the WAL frame and column encoders refuse it again as a backstop. It serialises like any unit variant (bincode tag = its index; serde JSON "Null"), so a query result carrying it can be sent anywhere a Value can.

Must stay the last variant. Add new variants above it.

Implementations§

Source§

impl Value

Source

pub fn contains_null(&self) -> bool

True if this value is Value::Null or holds one at any depth. A write path refuses such a value: a stored property can never be null.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

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 Debug for Value

Source§

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

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

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Value, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Value

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Value

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Forget for Value

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V