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
impl OwnedValue
pub fn str(s: &str) -> OwnedValue
pub fn str(s: &str) -> OwnedValue
Convenience constructor for tests/util.
pub fn is_null(&self) -> bool
pub fn is_absent(&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().
Trait Implementations§
§impl Clone for OwnedValue
impl Clone for OwnedValue
§fn clone(&self) -> OwnedValue
fn clone(&self) -> OwnedValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more