Skip to main content

write_twoda_with_options

Function write_twoda_with_options 

Source
pub fn write_twoda_with_options<W: Write>(
    writer: &mut W,
    twoda: &TwoDa,
    options: TwoDaBinaryOptions,
) -> Result<(), TwoDaBinaryError>
Expand description

Writes a binary 2DA (2DA V2.b) to a writer with explicit text options.

§Errors

TwoDaBinaryError::InvalidTable for a table the format cannot express, checked in full before anything is written: a column name or row label holding a NUL or a tab, a cell holding a NUL, or a row whose width does not match the column count. Those three bytes are the format’s own delimiters.

TwoDaBinaryError::ValueOverflow when the row count exceeds u32, or when a cell offset or the total cell-data size exceeds the u16 the format gives it. A table can therefore be valid in memory and too large to write.

TwoDaBinaryError::TextEncoding when a value has no form in options.text_encoding, naming which one, and TwoDaBinaryError::Io when the writer fails. Either can leave a partial file, since both are raised during the write rather than before it.