Expand description

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", b' ').unwrap(), Foo("foo".into(), 42));

Speed

The performance is comparable with serde_json (lower is better):

test csv_builder ... bench:      16,003 ns/iter (+/- 914)
test csv_core    ... bench:      15,695 ns/iter (+/- 1,155)
test csv_line    ... bench:         240 ns/iter (+/- 14)
test serde_json  ... bench:         124 ns/iter (+/- 5)

The benchmark code is here.

Structs

A struct to hold the parser settings

Enums

An error that can occur when processing CSV data

Functions

Deserializes the string

Deserialize a csv formatted &str where the separator is specified

Type Definitions

A type alias for Result<T, csv_line::Error>