Skip to main content

BufferedFixedColumn

Struct BufferedFixedColumn 

Source
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

Source

pub fn len(&self) -> usize

Number of buffered slots (indices.len() from the gather).

Source

pub fn is_empty(&self) -> bool

Source

pub fn read_u32(&self, slot: usize) -> Result<u32, Error>

Source

pub fn read_u64(&self, slot: usize) -> Result<u64, Error>

Source

pub fn read_i32(&self, slot: usize) -> Result<i32, Error>

Source

pub fn read_i64(&self, slot: usize) -> Result<i64, Error>

Source

pub fn read_f64(&self, slot: usize) -> Result<f64, Error>

Source

pub fn read_bool(&self, slot: usize) -> Result<bool, Error>

Source

pub fn read_uuid(&self, slot: usize) -> Result<[u8; 16], Error>

Source

pub fn read_timestamp(&self, slot: usize) -> Result<i64, Error>

Source

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).

Source

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).

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.