Skip to main content

Value

Enum Value 

Source
pub enum Value {
Show 21 variants Null, Void, Bool(bool), Int(i64), Float(f64), Str(String), FixedChar(String), Bytes(Vec<u8>), Temporal(TemporalValue), Decimal(DecimalValue), Json(String), JsonB(String), Array(ArrayValue), LegacyVector(LegacyVectorValue), List(Vec<Value>), Row(RowValue), Record(RecordValue), Map(BTreeMap<String, Value>), Enum(EnumValue), Datum(DatumValue), BitString(BitStringValue),
}
Expand description

Dynamic value type for document fields and posting payload extras.

Covers the JSON-like values the engine round-trips through a posting list. Date and datetime variants land with the SQL type system.

Variants§

§

Null

§

Void

Non-null zero-width value of PostgreSQL’s void pseudo-type.

§

Bool(bool)

§

Int(i64)

§

Float(f64)

§

Str(String)

§

FixedChar(String)

A PostgreSQL blank-padded CHARACTER(n) value. The stored string includes its physical trailing spaces; SQL comparisons ignore them.

§

Bytes(Vec<u8>)

§

Temporal(TemporalValue)

§

Decimal(DecimalValue)

§

Json(String)

Validated PostgreSQL json text. Unlike jsonb, the original whitespace and object-key order are preserved.

§

JsonB(String)

Canonical PostgreSQL jsonb text. Keeping a distinct carrier preserves JSON scalars and arrays across SQL, storage, and bindings.

§

Array(ArrayValue)

SQL array value with PostgreSQL dimension lower bounds.

§

LegacyVector(LegacyVectorValue)

Atomic int2vector or oidvector with a zero-based array view.

§

List(Vec<Value>)

Internal generic sequence carrier for vectors, tensors, JSON arrays, graph lists, and callback payloads. SQL arrays use Value::Array.

§

Row(RowValue)

Anonymous ROW(...) constructor. This stays distinct from arrays so row comparisons retain SQL three-valued NULL semantics.

§

Record(RecordValue)

Named composite/record value in physical field order.

§

Map(BTreeMap<String, Value>)

JSON/document object value. This is not a SQL composite record.

§

Enum(EnumValue)

Label of a user-defined enum type. The immutable label key orders values in declaration order; label text is resolved from the catalog.

§

Datum(DatumValue)

A retained SQL field that has not been physically interpreted. SQL must read it before value-based operations; NULL tests and type inspection do not read its bytes.

§

BitString(BitStringValue)

A finite packed bit sequence. SQL’s declaration descriptor distinguishes fixed and varying length constraints.

Implementations§

Source§

impl Value

Source

pub fn cmp_with_control( &self, other: &Value, control: &ProductionControl<'_>, ) -> Result<Ordering, ValueRetentionError>

Compare through the existing numeric and JSONB owners under the producer’s allowance. Borrowed scalar comparisons allocate nothing; recursive carriers retain traversal and comparison scratch only for the call.

Source§

impl Value

Source

pub fn clone_budgeted( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<Budgeted<Value>, ValueRetentionError>

Copy the value under one allowance, retaining the destination’s payload lease. Buffer capacity, array headers, decimal payloads and live map entries follow reserve_retained_payload; opaque B-tree node slack and allocator bookkeeping have the same separate ownership. Traversal uses a charged stack and checks cancellation between children and bounded string/byte chunks.

Source

pub fn clone_budgeted_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<Budgeted<Value>, ValueRetentionError>

Copy under the same payload and traversal contract as Self::clone_budgeted, checking all caller-owned cancellation scopes through one callback between children and bounded payload chunks. This supports retained resources whose original caller and current reader both remain cancellation owners.

Source

pub fn transform_with_control<E>( &self, control: &ProductionControl<'_>, replace: impl FnMut(&Value) -> Result<Option<Produced<Value>>, E>, ) -> Result<Produced<Value>, E>

Copy native containers with an iterative, admitted traversal. A replacement owns its admitted payload under the same control and stops traversal at that node; all other nodes preserve their shape, bounds and descriptors. Replacements are never interpreted by Core. A failed transform releases every partial copy.

Source§

impl Value

Source

pub fn from_json_fields_budgeted( fields: Budgeted<BTreeMap<String, Value>>, cancellation: &CancellationToken, ) -> Result<Budgeted<Value>, JsonReadError>

Apply the ordinary JSON visitor’s private-number and tagged-object rules to decoded fields. The input reservation must cover its live entries, key capacities and nested payloads; conversion retains that allowance and moves recognized buffers.

Source§

impl Value

Source

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

Compare retained variants and payloads without SQL coercion or normalization. Index-entry retention must distinguish signed zero, numeric scale, interval fields and nested array metadata even when the values compare equal.

Source§

impl Value

Source

pub fn reserve_retained_payload( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<MemoryReservation, ValueRetentionError>

Reserve owned string/vector capacities, array headers, decimal payloads and live map entries, excluding this value’s inline layout. B-tree node slack and allocator/reference-count bookkeeping are not exposed by these carriers and are outside this payload charge. The temporary traversal stack uses the same allowance and checks cancellation without recursive calls.

Source

pub fn reserve_retained_payload_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<MemoryReservation, ValueRetentionError>

Admit existing payload capacities while checking the caller’s original and invoking scopes through one callback.

Source

pub fn retained_payload_bytes( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<usize, ValueRetentionError>

Count the same owned payload as reserve_retained_payload without reserving that payload again. Only the temporary traversal stack uses the supplied allowance.

Source

pub fn retained_payload_bytes_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<usize, ValueRetentionError>

Count retained payload with caller-owned traversal scratch and cancellation checks. The count does not acquire a payload reservation or change the value’s existing owner.

Source§

impl Value

Source

pub fn array_view(&self) -> Option<&ArrayValue>

Borrow SQL array metadata, including a legacy vector’s own zero-based dimension. Array construction and row-major traversal still treat a legacy vector as one atomic element.

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

Source§

fn default() -> Value

Returns the “default value” for a type. 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 Eq for Value

Source§

impl ObserveAllocations for Value

Source§

fn observe_allocations<'a>( &'a self, observer: &mut AllocationObserver<'a, '_>, ) -> Result<(), ValueRetentionError>

Source§

impl Ord for Value

Source§

fn cmp(&self, other: &Value) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. 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 PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Value) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= 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

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

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<T> ErasedDestructor for T
where T: 'static,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.