pub struct SqliteRowStream<'s> { /* private fields */ }Expand description
The leaf row stream: a live rusqlite cursor (Rows) plus the per-column type
tags. Implements the foundations lending [RowStream]; each next_row
reborrows self, so the returned SqliteRow is invalidated by the next
call — the SQLite cursor contract, now a compile-time invariant.
's is the lifetime of the prepared statement the cursor borrows. The
statement is owned elsewhere (the caller / a pool), which sidesteps the
self-referential-struct problem (05 §13 Q1): a field borrowing another
field of the same struct is not expressible in safe Rust, so the statement
lives outside and the stream borrows it for 's.
Field order is load-bearing: rows (the cursor) is declared before _guard
so it drops first — the cursor is released before the “returned to pool”
guard fires.
Implementations§
Source§impl<'s> SqliteRowStream<'s>
impl<'s> SqliteRowStream<'s>
Sourcepub fn new(rows: Rows<'s>, types: &'s [ColType]) -> SqliteRowStream<'s>
pub fn new(rows: Rows<'s>, types: &'s [ColType]) -> SqliteRowStream<'s>
Wrap a rusqlite::Rows cursor (from stmt.query(params)) and its column
type tags.
Sourcepub fn guarded(
rows: Rows<'s>,
types: &'s [ColType],
guard: StmtGuard,
) -> SqliteRowStream<'s>
pub fn guarded( rows: Rows<'s>, types: &'s [ColType], guard: StmtGuard, ) -> SqliteRowStream<'s>
Same, but with a Primitive-#2 release guard (the open-cursor counter is decremented when this stream drops, including on early termination).
Sourcepub fn take_error(&mut self) -> Option<SqliteError>
pub fn take_error(&mut self) -> Option<SqliteError>
Re-raise the parked step error at the owning boundary. The node-stream /
fetch layer calls this after the scan drains (where the result type is
already fallible — 09); a leftover Some here means the scan hit a
sqlite3_step error that must propagate, NOT a clean end-of-stream.