| Crates.io | lazycsv |
| lib.rs | lazycsv |
| version | 0.3.0 |
| created_at | 2025-03-05 06:34:30.207161+00 |
| updated_at | 2025-04-28 11:31:11.999892+00 |
| description | Vectorized, lazy-decoding, zero-copy CSV parser. |
| homepage | |
| repository | https://github.com/contentstech-com/crates |
| max_upload_size | |
| id | 1578428 |
| size | 48,207 |
Vectorized, lazy-decoding, zero-copy CSV parser.
lazycsv is a parser that performs optimistic optimization. It’s primarily optimized for parsing CSV input that is either unquoted or only minimally quoted—especially when dequoting is unnecessary. In such cases, it can outperform BurntSushi/rust-csv by around 20% in terms of performance.
However, if the input is expected to require dequotation, it’s generally better to use BurntSushi/rust-csv, which performs eager dequoting during the parsing phase. Since lazycsv is a lazy parser, it defers dequoting entirely. If dequotation is performed later, this effectively results in scanning the input twice, which leads to a performance penalty.
#![no_std] eligible: The crate is #![no_std] compatible, and it can be used in systems without an allocator.lazycsv primarily supports a subset of RFC 4180 with minor extensions.
\n) instead of CRLF (\r\n) as the newline is permitted.use lazycsv::{Csv, CsvIterItem};
// Iterating over rows
let csv = Csv::new(b"a,b,c\n1,2,3");
for [first, second, third] in csv.into_rows() {
println!(
"{}, {}, {}",
first.try_as_str()?,
second.try_as_str()?,
third.try_as_str()?,
);
}
// Or if you want to avoid buffering:
let csv2 = Csv::new(b"a,b,c\n1,2,3");
for item in csv2 {
if let CsvIterItem::Cell(cell) = item {
println!("{}", cell.try_as_str()?);
}
}