pub struct IntermediateRepresentation {
pub header: SchemaHeader,
pub values: Vec<SchemaValue>,
}Expand description
The format-agnostic intermediate representation
This is the bridge between input formats (JSON) and the binary encoding. Data is stored in column-oriented, row-major order.
§Structure
- Header: Schema metadata (field names, types, counts)
- Values: Flat array of values in row-major order
§Row-Major Layout
For 2 rows × 3 fields, values are stored as:
[row0_field0, row0_field1, row0_field2, row1_field0, row1_field1, row1_field2]§Examples
ⓘ
use base_d::{IntermediateRepresentation, SchemaHeader, SchemaValue, FieldDef, FieldType};
let fields = vec![
FieldDef::new("id", FieldType::U64),
FieldDef::new("name", FieldType::String),
];
let header = SchemaHeader::new(2, fields);
let values = vec![
SchemaValue::U64(1),
SchemaValue::String("alice".to_string()),
SchemaValue::U64(2),
SchemaValue::String("bob".to_string()),
];
let ir = IntermediateRepresentation::new(header, values)?;Fields§
§header: SchemaHeader§values: Vec<SchemaValue>Implementations§
Source§impl IntermediateRepresentation
impl IntermediateRepresentation
Sourcepub fn new(
header: SchemaHeader,
values: Vec<SchemaValue>,
) -> Result<Self, SchemaError>
pub fn new( header: SchemaHeader, values: Vec<SchemaValue>, ) -> Result<Self, SchemaError>
Create a new IR
Trait Implementations§
Source§impl Clone for IntermediateRepresentation
impl Clone for IntermediateRepresentation
Source§fn clone(&self) -> IntermediateRepresentation
fn clone(&self) -> IntermediateRepresentation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IntermediateRepresentation
impl Debug for IntermediateRepresentation
impl StructuralPartialEq for IntermediateRepresentation
Auto Trait Implementations§
impl Freeze for IntermediateRepresentation
impl RefUnwindSafe for IntermediateRepresentation
impl Send for IntermediateRepresentation
impl Sync for IntermediateRepresentation
impl Unpin for IntermediateRepresentation
impl UnwindSafe for IntermediateRepresentation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more