Expand description
Minimal RFC 4180 CSV writer — zero deps. See csv::CsvWriter.
Minimal CSV writer — RFC 4180 compliant, zero deps.
§Quick start
ⓘ
use rustango::csv::CsvWriter;
let mut w = CsvWriter::new();
w.headers(&["id", "name", "email"]);
w.row(&["1", "Alice", "alice@example.com"]);
w.row(&["2", "Bob", "bob, jr.@example.com"]); // commas auto-quoted
let csv = w.into_string();§Quoting rules (RFC 4180)
- Wrap a field in
"..."if it contains,,",\r, or\n - Inside a quoted field,
"is doubled ("") - Plain ASCII without special chars goes unquoted
§Common use cases
- Admin “Export to CSV” buttons (large querysets)
- Logs / audit trail dumps
- Bulk data download endpoints
Structs§
- CsvWriter
- CSV writer that builds output into an in-memory
String.
Functions§
- csv_
from_ json_ rows - Build a
CsvWriterfrom a slice ofserde_json::Valuerows