Declaration
Csv_Options :: struct {
// an ASCII byte other than the quote, NUL, CR or LF delimiter: u8 = #char ","; quote: u8 = #char "\"";// treat the first record as column names; it is not returned header: bool;// drop spaces around unquoted fields trim: bool;// allow a quote inside an unquoted field lax_quotes: bool;// fail with .WIDTH when a record's field count differs from the first require_equal_width: bool; max_field_bytes: int = 1 << 20;// per record max_fields: int = 16384; max_record_bytes: int = 16 << 20;// used when writing; reading accepts all three line_ending := Csv_Line_Ending.CRLF;
// A typed row's strings (and the strings behind its optional pointers) are slices of the input when the field needed no unquoting, and copies when it had doubled quotes. borrow: bool;}How a CSV document is read and written.
Fields
- borrow: bool
- A typed row's strings (and the strings behind its optional pointers) are slices of the input
when the field needed no unquoting, and copies when it had doubled quotes. The input must
outlive the rows, and a row must not go through
csv_row_free(*row): decode withcontext.allocatorset to an arena ortempand reset that, or free throughcsv_row_free(*reader, *row), which leaves slices alone. Only for a slice input: a chunked source reuses its buffer, socsv_reader(.., source, ..)fails with.OPTIONS. Untyped records are always borrowed, so it changes nothing there.reader := csv_reader(User, input, .{ header = true, borrow = true },, temp); user, ok, error := csv_next(*reader,, temp); // user.name is a slice of `input` reset_temporary_storage();