Skip to main content

csv_record_end

Function csv_record_end 

Source
pub fn csv_record_end(buf: &[u8], delimiter: u8, quote: u8) -> Option<usize>
Expand description

Byte length of the first complete CSV record in buf — including its terminating \n — or None if the buffer does not yet hold a full record (an unterminated quoted field, or no record-ending newline yet). Quote-aware: a newline inside a quoted field is part of the record. The quote character only opens a quoted field at the start of a field (buffer start or right after a delimiter), so delimiter is needed to track field boundaries. Scanning raw bytes is UTF-8-safe because the ASCII delimiter / quote / newline never collide with a multi-byte continuation byte (which is always ≥ 0x80).