Expand description
High-level CSV reading, writing, and manipulation.
Fully RFC 4180 compliant with zero external dependencies. Supports quoted fields,
escaped quotes (doubled ""), newlines within quoted fields, custom delimiters,
and automatic delimiter detection.
§Reading CSV
use philiprehberger_csv_toolkit::CsvReader;
let data = "name,age,city\nAlice,30,NYC\nBob,25,LA";
let reader = CsvReader::parse(data);
assert_eq!(reader.get(0, "name"), Some("Alice"));
assert_eq!(reader.column("age"), Some(vec!["30", "25"]));§Writing CSV
use philiprehberger_csv_toolkit::CsvWriter;
let output = CsvWriter::new()
.headers(&["name", "score"])
.row(&["Alice", "95"])
.row(&["Bob", "87"])
.render();
assert_eq!(output, "name,score\nAlice,95\nBob,87\n");Structs§
- CsvReader
- A CSV reader that parses CSV data and provides access to headers, rows, and cells.
- CsvWriter
- A CSV writer that builds CSV output from headers and rows.
Enums§
- CsvError
- Errors that can occur during CSV operations.