Rindle docs and package mapSkip to main content

OwnedValue

Enum OwnedValue 

pub enum OwnedValue {
    Absent,
    Null,
    Bool(bool),
    Int(i64),
    Float(f64),
    Str(Arc<str>),
    Json(Arc<str>),
}
Expand description

Owned counterpart, used wherever a value must outlive the cursor step that produced it: overlays, the memory store (the COW B+tree), the view, and operator-buffered state (Take/Exists, merge-heap heads).

Str is Arc<str> (validated UTF-8): sharing an owned string is a refcount bump, and the owned form is the app-facing one, so it is the right place to have paid for validation. (Foundations §2.2 allows Box<str>; Arc<str> wins here because owned rows are aliased pervasively.)

Serde (gated, like crate::ast::Ast) is the flat-change wire encoding (FLAT-CHANGES-DESIGN.md §5.1). It is externally tagged ("Null", {"Int":5}, {"Str":"x"}, {"Json":"…"}) — not the lossy JS-marshal collapse (Int/Float→number, Str/Json→string). Faithful ArrayView reconstruction requires the exact variant: a receiver’s compare_values panics on a cross-type pair (e.g. Str vs Json) and orders Int/Float by distinct arms, so the wire must preserve which variant a cell is.

Variants§

§

Absent

Absent — the cell does not exist on this (partial / projected) union row. The source-of-truth presence signal for a positional row (PROJECTION-SUPPORT-DESIGN.md §3.1, D-1): a positional array cannot otherwise distinguish present-and-Null from absent. Containable — after a connection’s presence predicate (§3.3) admits a row, Absent survives only in columns that query does not read, which are projected away at the view boundary. Never constructed on the server (its rows are always complete) and never marshalled to a view (owned_value_to_js asserts this).

§

Null

§

Bool(bool)

§

Int(i64)

§

Float(f64)

§

Str(Arc<str>)

§

Json(Arc<str>)

Raw json text (unparsed; a parse cache would be an impl detail).

Implementations§

§

impl OwnedValue

pub fn str(s: &str) -> OwnedValue

Convenience constructor for tests/util.

pub fn is_null(&self) -> bool

pub fn is_absent(&self) -> bool

Whether this cell is OwnedValue::Absent — the column-presence test (PROJECTION-SUPPORT-DESIGN.md §3.1). Presence is !is_absent().

pub fn as_ref(&self) -> Value<'_>

Owned → borrowed bridge. Zero copy: hands out a byte view into the owned storage (and a Copy scalar otherwise). This is what lets the memory backend, overlays, and buffered state reach Value<'_> (and the comparators) without re-allocating.

Trait Implementations§

§

impl Clone for OwnedValue

§

fn clone(&self) -> OwnedValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
§

impl Debug for OwnedValue

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for OwnedValue

§

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

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

impl Serialize for OwnedValue

§

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§

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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