Just CSV reader/writer
Inspired by csv_simple
crate.
Conforms the RFC 4180. Please be aware of that RFC. According to RFC CSV-file is ASCII-only, this crate treats CSV-files as UTF-8.
Reader API
Config struct exported as CsvReaderConfig
in lib.rs
implements builder pattern and Default trait.
CsvReader::headers(...)
returns Some
if config.has_headers == true
and parsing first record was successful. If you passed config.has_headers == true
but get None
from CsvReader::headers(...)
means parsing first record failed. Note that iterating through such a reader is undefined behaviour.
Writer API
Is not as convinient as Reader API. It just helps you to escape special characters while writing to the dest
.
Headers have no special treatment, they are just another row. Only if you try to write them after records you get an error.
// as CsvWriterConfig
Config struct exported as CsvWriterConfig
in lib.rs
implements builder pattern and Default trait.
License
Due to nom the crate has MIT License.