pub struct Dialect {
pub delimiter: u8,
pub quote: Option<u8>,
pub escape: Option<u8>,
pub header: bool,
}Expand description
How a CSV file is punctuated.
Fields§
§delimiter: u8The byte between two fields.
quote: Option<u8>The byte that opens and closes a field that may hold a delimiter or a newline, if the file has one.
escape: Option<u8>The byte that makes the next quote a literal one, if the file has one. When it is the quote itself, which is what RFC 4180 says and what every writer does, a doubled quote is one quote.
header: boolWhether the first line names the columns rather than being one of them.
Implementations§
Source§impl Dialect
impl Dialect
Sourcepub const fn comma_separated() -> Self
pub const fn comma_separated() -> Self
The dialect a file with nothing unusual in it has.
Sourcepub const fn quote_byte(self) -> u8
pub const fn quote_byte(self) -> u8
The quote byte, or the double quote when the file has none.
A file with no quote in it still needs a byte to compare against while splitting, and the one that cannot appear is the one that never appeared. Splitting on the default is what makes a quote that turns up after the sample still read as a quote.
Sourcepub const fn escape_byte(self) -> u8
pub const fn escape_byte(self) -> u8
The escape byte, or the quote byte when the file has none.