Rindle docs and package mapSkip to main content

RowRef

Trait RowRef 

pub trait RowRef {
    // Required methods
    fn col(&self, c: usize) -> Value<'_>;
    fn len(&self) -> usize;
    fn to_owned_row(&self) -> OwnedRow;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn try_to_owned_row(&self) -> Result<OwnedRow, RindleError> { ... }
}
Expand description

A borrowed view of one row; columns addressed by ColId. The returned Value borrows self, so it is valid only as long as the row reference — for the SQLite leaf that means until the next next_row.

Not lifetime-parameterized (a refinement of foundations’ RowRef<'a>): col(&self) -> Value<'_> ties the cell to the &self borrow, which makes the RowStream GAT bound (type Row<'a>: RowRef) clean — no HRTB. The only cost is that a cell cannot be held past the row reference without to_owned, which is exactly the contract we want.

Required Methods§

fn col(&self, c: usize) -> Value<'_>

Read column c, zero-copy.

fn len(&self) -> usize

Number of columns.

fn to_owned_row(&self) -> OwnedRow

Materialize the whole row. For the held-Rc memory backend this is an O(1) Arc bump (the impl on &OwnedRow below); for the SQLite leaf it is the one forced per-row copy out of the step buffer (sqlite.rs).

Provided Methods§

fn is_empty(&self) -> bool

fn try_to_owned_row(&self) -> Result<OwnedRow, RindleError>

Fallible materialization for external data. Memory-backed rows override nothing because owning is an Arc bump; SQLite rows override this to surface invalid text/json as RindleError instead of panicking.

Implementations on Foreign Types§

§

impl RowRef for &[OwnedValue]

Bridge for a bare owned-cell slice (e.g. a constraint/key vector or a synthesized cell list that was never a flat row). Here to_owned_row must build a fresh flat row (one allocation; text bytes are copied out of the Arc<str> cells, which are valid UTF-8 by construction).

§

fn col(&self, c: usize) -> Value<'_>

§

fn len(&self) -> usize

§

fn to_owned_row(&self) -> OwnedRow

Implementors§

§

impl RowRef for &OwnedRow

THE canonical owned→borrowed bridge for the memory backend. Vending a &OwnedRow (rather than a &[OwnedValue] slice) is what makes to_owned_row an O(1) Arc bump instead of a deep copy — folding the btree spike’s current_arc escape hatch (04 OQ-2) into the shared trait. The BTreeCursor sets type Row<'a> = &'a OwnedRow and gets owning-at-the-node -boundary for free.