RowSchema

Trait RowSchema 

Source
pub trait RowSchema {
    // Required methods
    fn schema() -> &'static [&'static str]
       where Self: Sized;
    fn column_count(&self) -> usize;
    fn get_column(&self, idx: usize) -> Result<ColumnValue<'_>, ColumnError>;
}
Expand description

Trait for types that can describe their columnar schema and provide column values.

This trait enables generic serialization of row types to columnar formats. Implementations are typically generated by the SerializeRow derive macro.

The trait is object-safe: schema() has a Self: Sized bound which excludes it from the vtable, while column_count() and get_column() can be called on trait objects.

Required Methods§

Source

fn schema() -> &'static [&'static str]
where Self: Sized,

Returns the column names for this row type.

This method requires Self: Sized and cannot be called on trait objects. Use column_count() for the number of columns when working with dyn RowSchema.

Source

fn column_count(&self) -> usize

Returns the number of columns in the schema.

This is an object-safe alternative to schema().len() for use with trait objects.

Source

fn get_column(&self, idx: usize) -> Result<ColumnValue<'_>, ColumnError>

Returns the value at the given column index.

Returns an error if the index is out of bounds.

Implementations on Foreign Types§

Source§

impl<T: RowSchema> RowSchema for Arc<T>

Blanket implementation for Arc<T> - delegates to inner type. This allows processors to return Arc<RowType> while still satisfying RowSchema.

Source§

fn schema() -> &'static [&'static str]
where Self: Sized,

Source§

fn column_count(&self) -> usize

Source§

fn get_column(&self, idx: usize) -> Result<ColumnValue<'_>, ColumnError>

Implementors§