logos.mem.encoding.csv
Module mem · package logos-mem
Types
structCsvReader
struct CsvReader
Stateful RFC 4180 CSV reader that decodes one field per read_field call.
Holds a raw pointer into the source buffer; the source must outlive the reader.
Fields
end: i64
pos: i64
src: *const u8
Methods
fn eof(self: &CsvReader) -> bool
Returns true when all input has been consumed.
fn new(s: &[u8]) -> CsvReader
Creates a reader over the bytes of s.
Borrows s via raw pointer: s must remain live and unmodified while reading.
fn read_field(self: &mut CsvReader, out: &mut String, is_row_end: &mut bool) -> bool
Reads the next field, appending its decoded bytes to out.
Sets is_row_end when the field is the last on its row (newline or EOF follows).
Returns false at EOF before any content, or on a malformed quoted field
(unterminated, or stray bytes after the closing quote); out may be partially filled.
Functions
fnwrite_field
fn write_field(src: *const u8, len: i64, out: &mut String) -> void
Appends the len bytes at src to out as one CSV field.
Quotes the field and doubles embedded quotes when it contains ,, ", CR, or LF.
fnwrite_field_str
fn write_field_str(s: &[u8], out: &mut String) -> void
Appends s to out as one CSV field, quoting when necessary (see write_field).
fnwrite_newline
fn write_newline(out: &mut String) -> void
Writes a row terminator (CRLF, per RFC 4180) to out.
fnwrite_sep
fn write_sep(out: &mut String) -> void
Writes a field separator (,) to out; call between fields.