overload 1
csv_next :: (r: *Csv_Reader(void)) -> ([] string, bool, Csv_Error)
Returns the next record as borrowed fields, or false with .NONE at the end of the input. With
a header the first record is consumed as the column names.
Example:
#import "Extensions/Csv";
r := csv_reader(cast([] u8) "a,b\n1,2\n");
defer csv_reader_free(*r);
fields, present, error := csv_next(*r);
assert(present && fields.count == 2 && fields[1] == "b");overload 2
csv_next :: (r: *Csv_Reader($Row)) -> (Row, bool, Csv_Error)
Returns the next record decoded into the reader's Row, or false with .NONE at the end of
the input. The row owns its strings (see Csv_Options.borrow); release it with csv_row_free.
A failure is final: the row holds what was decoded before it, already released.
Example:
#import "Extensions/Csv";
User :: struct {
name: string;
age: int;
}
r := csv_reader(User, cast([] u8) "ada,36\nbob,x\n");
defer csv_reader_free(*r);
user, present, error := csv_next(*r);
assert(present && user.age == 36);
csv_row_free(*user);
_, present, error = csv_next(*r);
assert(!present && error.kind == .TYPE && error.column_name == "age");