Skip to main content

build_columnar_record

Function build_columnar_record 

Source
pub fn build_columnar_record(
    from: &str,
    type_name: &str,
    fields: &[(&str, WireColumn<'_>)],
) -> Vec<u8> 
Expand description

Build a columnar record message in place — Cap’n Proto’s home turf. The named columns are written DIRECTLY into the offset-table T_STRUCT_VIEW + T_*_ALIGNED wire layout from borrowed slices: no intermediate RuntimeValue, no second serialize pass over the data (each column is a single memcpy). The receiver opens it with view_message and reads ANY column in O(1) and zero-copy via WireView::struct_field + WireView::as_i64_slice/WireView::as_f64_slice.

This is the encode side of the dual zero-encode / zero-decode story: where capnp builds the message in its wire buffer and reads it in place, this writes the same aligned layout in one pass and reads it back with no decode — while staying name-elided and 24–34 % smaller on the wire.