Skip to main content

read_twoda_from_bytes_with_options

Function read_twoda_from_bytes_with_options 

Source
pub fn read_twoda_from_bytes_with_options(
    bytes: &[u8],
    options: TwoDaBinaryOptions,
) -> Result<TwoDa, TwoDaBinaryError>
Expand description

Reads a binary 2DA (2DA V2.b) from in-memory bytes with explicit text options.

ยงErrors

TwoDaBinaryError::InvalidMagic when the signature is not 2DA , and TwoDaBinaryError::InvalidVersion for a version other than V2.b.

TwoDaBinaryError::InvalidHeader covers every structural failure, and it is the arm most malformed files land on: a truncated header, a missing terminator for the column list or a row label, an offset table or cell region running past the end of bytes, a cell offset outside the cell region, a cell with no NUL terminator, and any cursor arithmetic that overflows. The message names which one.

TwoDaBinaryError::TextDecoding when a column name, row label or cell is not valid text in options.text_encoding, naming which one.