pub struct BufferedFixedColumn { /* private fields */ }Expand description
An in-memory bulk-loaded selection of a FixedColumn’s rows (#168).
Produced by FixedColumn::gather_buffered, it holds one column’s selected
rows as a single contiguous buffer (a zero-copy mmap alias of the dense
prefix, or a gathered copy) and exposes the same positional
read_* accessors as FixedColumn, addressed by slot (0..n over the
selection order) rather than physical row index. Decoding one column of a
scan from this buffer costs no syscalls; it lets the generated column scan
decode with the identical per-field logic it uses for per-row reads.
Errors mirror FixedColumn: an out-of-range slot returns InvalidInput.
Implementations§
Source§impl BufferedFixedColumn
impl BufferedFixedColumn
pub fn is_empty(&self) -> bool
pub fn read_u32(&self, slot: usize) -> Result<u32, Error>
pub fn read_u64(&self, slot: usize) -> Result<u64, Error>
pub fn read_i32(&self, slot: usize) -> Result<i32, Error>
pub fn read_i64(&self, slot: usize) -> Result<i64, Error>
pub fn read_f64(&self, slot: usize) -> Result<f64, Error>
pub fn read_bool(&self, slot: usize) -> Result<bool, Error>
pub fn read_uuid(&self, slot: usize) -> Result<[u8; 16], Error>
pub fn read_timestamp(&self, slot: usize) -> Result<i64, Error>
Sourcepub fn read_bytes(&self, slot: usize) -> Result<Vec<u8>, Error>
pub fn read_bytes(&self, slot: usize) -> Result<Vec<u8>, Error>
The whole value_size-wide value at slot (for char(N) / struct /
fixed-array / nullable / optional-FK columns decoded via read_unaligned).
Sourcepub fn read_slice(&self, slot: usize) -> Result<&[u8], Error>
pub fn read_slice(&self, slot: usize) -> Result<&[u8], Error>
The whole value_size-wide slot at slot, borrowed (#238).
The zero-copy counterpart of Self::read_bytes, which is exactly this
plus a .to_vec(); both stay, because a caller that wants an owned buffer
should not have to write the copy itself.
Borrowing is sound here and nowhere else on the fixed path: this type owns
its bytes (a gathered Vec or an Mmap alias of the dense prefix), so the
&self lifetime is the buffer’s. FixedColumn and FixedColumnReader
read through the file on every access and have nothing to lend — the same
split that put BufferedVariableColumn::read_str on the buffered tier
only (#224).
Sourcepub fn read_str(&self, slot: usize) -> Result<&str, Error>
pub fn read_str(&self, slot: usize) -> Result<&str, Error>
The whole value_size-wide slot at slot as UTF-8, borrowed (#238).
For a column where the slot is the value and carries no framing:
string(N!) (#238 res 6 — exactly N ASCII characters, therefore exactly N
bytes, therefore no length prefix), and any other fixed UTF-8 payload.
It deliberately does not understand a length prefix. Which slots carry
one, and how wide it is, is #238’s per-declaration layout choice; teaching
it to a schema-agnostic crate would move generated knowledge into the
substrate. Prefixed slots read through Self::read_slice and decode in
generated code.
§Errors
InvalidInput if the slot is out of range; InvalidData if the slot’s
bytes are not valid UTF-8 — same contract as
BufferedVariableColumn::read_str.