Enum Value
pub enum Value<'a> {
Absent,
Null,
Bool(bool),
Int(i64),
Float(f64),
Str(&'a [u8]),
Json(&'a [u8]),
}Expand description
A cell value as seen while streaming. Str/Json borrow raw bytes from
the underlying buffer — a SQLite column-text pointer (valid only until the
next step) or the bytes inside an owned row — so the whole value is valid
only for 'a.
Value<'a>: Copy: it is just a tag plus a primitive or a fat pointer, so
passing it around the hot path is free. Str/Json are &[u8], not &str
(see the module docs): bytewise compare on the hot path, validate at the
escape.
Variants§
Absent
Absent — the cell does not exist on this (partial / projected) row, as
distinct from present-and-Value::Null. The borrowed mirror of
OwnedValue::Absent (PROJECTION-SUPPORT-DESIGN.md §3.1). It is the unique
minimum in compare_values (below Null) so the shared source’s secondary
indexes stay totally ordered over partial union rows; it is never met on a
column a query sorts/joins/filters by (those are presence-required, §2.1), and
is never produced on the server (full rows) nor delivered to a view.
Null
Bool(bool)
Int(i64)
Float(f64)
Str(&'a [u8])
Borrowed UTF-8-ish text, zero-copy from the step buffer; compared bytewise.
Json(&'a [u8])
Borrowed unparsed JSON text; parsed lazily only if compared/needed.
Implementations§
§impl Value<'_>
impl Value<'_>
pub fn is_null(&self) -> bool
pub fn is_absent(&self) -> bool
pub fn is_absent(&self) -> bool
Whether this cell is Value::Absent (the borrowed presence test).
pub fn try_to_owned(&self) -> Result<OwnedValue, RindleError>
pub fn try_to_owned(&self) -> Result<OwnedValue, RindleError>
Borrowed → owned. THE allocation site — the only place a transient
cell becomes heap-resident. For Str/Json this also performs the UTF-8
validation the bytes representation deferred (the app-escape boundary).
pub fn to_owned(&self) -> OwnedValue
pub fn to_owned(&self) -> OwnedValue
Infallible compatibility wrapper. Production call sites that handle
external data should use Value::try_to_owned.