4 releases (2 breaking)
Uses new Rust 2024
| 0.3.0 | Jul 19, 2025 |
|---|---|
| 0.2.0 | Aug 17, 2022 |
| 0.1.1 | Aug 17, 2022 |
| 0.1.0 | Nov 26, 2021 |
#8 in #single-line
295 downloads per month
Used in csv-partial-cache
22KB
372 lines
Fast deserialization of a single CSV line.
Usage
#[derive(Debug, PartialEq, serde::Deserialize)]
struct Foo(String, i32);
assert_eq!(
csv_line::from_str::<Foo>("foo,42").unwrap(),
Foo("foo".into(), 42)
);
assert_eq!(
csv_line::from_str_sep::<Foo>("foo 42", ' ').unwrap(),
Foo("foo".into(), 42)
);
Speed
The performance is comparable to serde_json (lower is better):
test csv_builder ... bench: 13,190.73 ns/iter (+/- 793.61)
test csv_core ... bench: 12,840.18 ns/iter (+/- 633.12)
test csv_line ... bench: 176.50 ns/iter (+/- 5.15)
test serde_json ... bench: 88.24 ns/iter (+/- 2.12
The benchmark code is available here.
Contributing
Please run .pre-commit.sh before submitting a pull request to ensure all checks pass.
License
This project is licensed under the MIT license.
Dependencies
~1.2–1.7MB
~21K SLoC