commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
1014ac364725386579ecbd21a520a9d3eb56979e | Vincent Prouillet | 2017-01-19T04:57:42 | Ignore unused val in test | diff --git a/validator_derive/tests/test_derive.rs b/validator_derive/tests/test_derive.rs
index d456be6..24c408a 100644
--- a/validator_derive/tests/test_derive.rs
+++ b/validator_derive/tests/test_derive.rs
@@ -297,7 +297,7 @@ fn test_can_validate_option_fields_with_lifetime() {
custom: Option<&'a str>,
... | 1 | 1 | 1 |
c8fb03bdd7391fc7b9fdc56efcc55a5eec08e19c | Vincent Prouillet | 2017-01-19T04:35:05 | Validators work for Option<TYPE> | diff --git a/validator_derive/src/lib.rs b/validator_derive/src/lib.rs
index 177f315..0ad26a9 100644
--- a/validator_derive/src/lib.rs
+++ b/validator_derive/src/lib.rs
@@ -71,10 +71,12 @@ fn expand_validation(ast: &syn::MacroInput) -> quote::Tokens {
quote!(&self.#field_ident)
};
// same b... | 2 | 63 | 14 |
696e4273173033a6b1d488416c5433d9c49eb8e9 | Vincent Prouillet | 2017-01-18T13:43:34 | Validator works for Option<& | diff --git a/validator/src/contains.rs b/validator/src/contains.rs
index 89f7523..0c9d02e 100644
--- a/validator/src/contains.rs
+++ b/validator/src/contains.rs
@@ -7,6 +7,12 @@ pub trait Contains {
fn has_element(&self, needle: &str) -> bool;
}
+impl Contains for String {
+ fn has_element(&self, needle: &st... | 4 | 210 | 74 |
1fd1b3d708a2737c2a678df8a37e719c29c754bc | Vincent Prouillet | 2017-01-18T12:35:01 | Make it work with lifetimes | diff --git a/validator_derive/Cargo.toml b/validator_derive/Cargo.toml
index fc4a3be..3cbe9a8 100644
--- a/validator_derive/Cargo.toml
+++ b/validator_derive/Cargo.toml
@@ -24,5 +24,5 @@ regex = "0.2"
lazy_static = "0.2"
[dependencies.validator]
-# path = "../validator"
-version = "0.3.0"
+path = "../validator"
+# ... | 5 | 68 | 14 |
8f54c9228d8cf8e2bede37ddc9958db7ce4c63a8 | Vincent Prouillet | 2017-01-18T12:34:53 | Use chars().count() instead of len() | diff --git a/validator/src/length.rs b/validator/src/length.rs
index f54a002..965d43b 100644
--- a/validator/src/length.rs
+++ b/validator/src/length.rs
@@ -8,15 +8,21 @@ pub trait HasLen {
fn length(&self) -> u64;
}
+impl HasLen for String {
+ fn length(&self) -> u64 {
+ self.chars().count() as u64
+... | 1 | 14 | 2 |
d8298ba2c96692cf4fb954393afb9fe10cb31b4c | Vincent Prouillet | 2017-01-17T08:58:38 | Remove * for compiletest_rs version | diff --git a/validator_derive/Cargo.toml b/validator_derive/Cargo.toml
index 84b41dc..da556a7 100644
--- a/validator_derive/Cargo.toml
+++ b/validator_derive/Cargo.toml
@@ -19,7 +19,7 @@ quote = "0.3"
serde = "0.8"
serde_derive = "0.8"
serde_json = "0.8"
-compiletest_rs = "*"
+compiletest_rs = "0.2"
[dependencies... | 1 | 1 | 1 |
79390798fdb86a6eadfb1e34e1157ee0fe69db34 | Vincent Prouillet | 2017-01-17T08:35:51 | validator_derive v0.2 | diff --git a/validator_derive/src/lib.rs b/validator_derive/src/lib.rs
index fd02e3d..9725ab6 100644
--- a/validator_derive/src/lib.rs
+++ b/validator_derive/src/lib.rs
@@ -130,17 +130,27 @@ fn expand_validation(ast: &syn::MacroInput) -> quote::Tokens {
let struct_validation_tokens = match struct_validation {
... | 1 | 15 | 5 |
3302d261744c12001ec2cd980fffd32a829185aa | Vincent Prouillet | 2017-01-16T09:46:49 | Update regex and drop proc_macro feature, its stable | diff --git a/validator/Cargo.toml b/validator/Cargo.toml
index 618c114..d622f9e 100644
--- a/validator/Cargo.toml
+++ b/validator/Cargo.toml
@@ -10,6 +10,6 @@ keywords = ["validation", "api", "validator"]
[dependencies]
url = "1.2"
-regex = "0.1"
+regex = "0.2"
lazy_static = "0.2"
idna = "0.1"
diff --git a/valida... | 4 | 4 | 5 |
a0a3c9e4b493c216fb6d8284c9ac918444ba67f3 | Andrew Gallant | 2025-10-17T13:55:34 | csv-core-0.1.13 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 0bb12fb..a7404c2 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.12" #:version
+version = "0.1.13" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bone... | 1 | 1 | 1 |
f8e6b0781080f4b172983cab9480d7f255dd8146 | Paolo Barbolini | 2025-10-17T13:54:20 | deps: switch `serde` dependency to `serde_core`
This should help make builds faster by divorcing the
interdependence between `serde` and `serde_derive`.
This also drops use of `serde::serde_if_integer128!`, since
our MSRV is new enough (for quite some time now) to
not need this.
PR #403 | diff --git a/Cargo.toml b/Cargo.toml
index 60716b6..6f84d85 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,11 +24,11 @@ bench = false
csv-core = { path = "csv-core", version = "0.1.11" }
itoa = "1"
ryu = "1"
-serde = "1.0.55"
+serde_core = "1.0.221"
[dev-dependencies]
bstr = { version = "1.7.0", default-feature... | 8 | 103 | 142 |
7c7c1359cfa64b5cf4770f767e566fd80c98388e | Paolo Barbolini | 2025-10-17T11:51:07 | style: address many Clippy lints
PR #408 | diff --git a/benches/bench.rs b/benches/bench.rs
index 2d742e7..d8469a3 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -12,11 +12,10 @@ use csv::{
WriterBuilder,
};
-static NFL: &'static str = include_str!("../examples/data/bench/nfl.csv");
-static GAME: &'static str = include_str!("../examples/data/be... | 15 | 81 | 87 |
5b2da187f236b0f95e61d48503d23cb2bcd9fada | Noah Moss | 2025-10-12T19:36:41 | doc: simplify tutorial section on accessing headers
The ceremony around appeasing the borrow checker
is no longer needed (thanks to NLL).
PR #406 | diff --git a/examples/tutorial-read-headers-02.rs b/examples/tutorial-read-headers-02.rs
index 951473a..1d82fa8 100644
--- a/examples/tutorial-read-headers-02.rs
+++ b/examples/tutorial-read-headers-02.rs
@@ -2,17 +2,13 @@ use std::{error::Error, io, process};
fn run() -> Result<(), Box<dyn Error>> {
let mut rd... | 2 | 7 | 33 |
633552a12ddeb2e2b12f6408e3e56d3ea1da1d54 | Paolo Barbolini | 2025-08-18T12:22:49 | perf: serialize 128-bit integers via `itoa`
This optimizes the `serialize_i128` and `serialize_u128`
implementations by having them use `itoa`, as all of the other
integer implementations do. This avoids going through the `Display`
implementation of `u128`/`i128` and an intermediate allocation, which
is necessary beca... | diff --git a/src/serializer.rs b/src/serializer.rs
index de5c248..96d7cf6 100644
--- a/src/serializer.rs
+++ b/src/serializer.rs
@@ -68,7 +68,8 @@ impl<'a, 'w, W: io::Write> Serializer for &'a mut SeRecord<'w, W> {
serde_if_integer128! {
fn serialize_i128(self, v: i128) -> Result<Self::Ok, Self::Error> ... | 1 | 4 | 2 |
e9f06f47aa7a990152ac8c92e6ae71ab5f80e52f | Paolo Barbolini | 2025-08-18T12:20:50 | lint: fix `needless_lifetimes` and `mismatched_lifetime_syntaxes`
PR #399 | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 58fadfe..08e7169 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -50,7 +50,7 @@ impl<T: AsRef<[u8]>> PartialEq<Vec<T>> for ByteRecord {
}
}
-impl<'a, T: AsRef<[u8]>> PartialEq<Vec<T>> for &'a ByteRecord {
+impl<T: AsRef<[u8]>> PartialEq<Vec<... | 3 | 9 | 9 |
9dab9474e796539cb44d412f5854572a0c852b75 | Paolo Barbolini | 2025-08-17T12:38:51 | test: fix broken test after panic message change
Ref https://github.com/rust-lang/rust/pull/115746 | diff --git a/tests/tests.rs b/tests/tests.rs
index ba73954..0d8a359 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -86,7 +86,8 @@ quux,baz,foobar
";
let mut cmd = cmd_for_example("tutorial-error-01");
let out = cmd_output_with(&mut cmd, data.as_bytes());
- assert!(out.stderr().contains("thread 'main'... | 1 | 2 | 1 |
da0008884062cf222ceb9c05f006be4bb6ac38a7 | Thalia Archibald | 2025-04-05T11:27:48 | style: address many Clippy lints
PR #392 | diff --git a/csv-core/src/lib.rs b/csv-core/src/lib.rs
index 08568e7..1e41cb5 100644
--- a/csv-core/src/lib.rs
+++ b/csv-core/src/lib.rs
@@ -114,10 +114,11 @@ mod writer;
///
/// Use this to specify the record terminator while parsing CSV. The default is
/// CRLF, which treats `\r`, `\n` or `\r\n` as a single record... | 11 | 53 | 91 |
f973cd49a91e5f71d063b45ffeb469765c4f5a86 | Thalia Archibald | 2025-03-18T18:09:43 | enum: use `#[non_exhaustive]` instead of `#[doc(hidden)]` variant
This was introduced in Rust 1.40, which is below the MSRV of 1.73.
Closes #325 | diff --git a/csv-core/src/lib.rs b/csv-core/src/lib.rs
index 747e58d..08568e7 100644
--- a/csv-core/src/lib.rs
+++ b/csv-core/src/lib.rs
@@ -115,18 +115,12 @@ mod writer;
/// Use this to specify the record terminator while parsing CSV. The default is
/// CRLF, which treats `\r`, `\n` or `\r\n` as a single record term... | 5 | 6 | 51 |
eca0fede3debebefe53a49571565db4f43826e01 | Andrew Gallant | 2025-02-12T16:08:26 | csv-core-0.1.12 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index bf48f97..0bb12fb 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.11" #:version
+version = "0.1.12" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bone... | 1 | 1 | 1 |
066de4aaf5dbf2c82bdb03fb574d905dde172d8a | Lev Kokotov | 2025-02-12T16:08:16 | csv-core: fix `Reader::reset` not resetting output_pos
FIxes #382, PR #383 | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index dbd6dc3..5e4e291 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -487,6 +487,7 @@ impl Reader {
self.nfa_state = NfaState::StartRecord;
self.line = 1;
self.has_read = false;
+ self.output_pos = 0;
... | 1 | 24 | 0 |
a3c275c9b8fbe330df0ec0579074dd59d635816a | Andrew Gallant | 2024-12-31T13:32:49 | msrv: bump to Rust 1.73
Since our dependencies (`bstr` I think) now require a higher MSRV. | diff --git a/Cargo.toml b/Cargo.toml
index 8a24b9c..60716b6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ license = "Unlicense/MIT"
categories = ["encoding", "parser-implementations"]
exclude = ["/.github", "/ci/*", "/scripts/*"]
edition = "2021"
-rust-version = "1.65"
+rust-version = "1.73"
[workspa... | 1 | 1 | 1 |
ce01ae7fe4cf7938a22ca565c33678e7422da6c0 | Aliakbar | 2024-11-09T12:50:52 | reader: tweak record trimming logic
Fixes #237 | diff --git a/src/reader.rs b/src/reader.rs
index 82f5d2c..9adeab8 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -1606,7 +1606,8 @@ impl<R: io::Read> Reader<R> {
}
return result;
}
- } else if self.state.trim.should_trim_fields() {
+ }
+ if self.sta... | 1 | 16 | 1 |
e123861dbffd496ed621dcf9dd789150b54e9c91 | Andrew Gallant | 2023-10-03T13:15:14 | deps: bump csv-core to 0.1.11 | diff --git a/Cargo.toml b/Cargo.toml
index 46dd9ed..cb0961b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ members = ["csv-core", "csv-index"]
bench = false
[dependencies]
-csv-core = { path = "csv-core", version = "0.1.10" }
+csv-core = { path = "csv-core", version = "0.1.11" }
itoa = "1"
ryu = "1"
... | 1 | 1 | 1 |
44b836cf9216a22bf150aecf7b7f0918fd96e680 | Andrew Gallant | 2023-10-03T13:15:00 | csv-core-0.1.11 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 110ee06..bf48f97 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.10" #:version
+version = "0.1.11" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bone... | 1 | 1 | 1 |
0f64d3f3322b30af7a38e222bd7dad18eac38b2b | Damien Elmes | 2022-06-08T08:01:27 | api: automatically escape fields that contain the comment character
Previously, if data is written with QuoteStyle::Necessary, and the
first field of a row happens to contain a comment character, the row
will be ignored as a comment when later reading it back in.
This change adds a `comment` property to Writer, and a... | diff --git a/csv-core/src/writer.rs b/csv-core/src/writer.rs
index 4f94301..ba196b6 100644
--- a/csv-core/src/writer.rs
+++ b/csv-core/src/writer.rs
@@ -26,6 +26,7 @@ impl WriterBuilder {
quote: b'"',
escape: b'\\',
double_quote: true,
+ comment: None,
};
... | 2 | 75 | 0 |
0cf3f6cb0d0f7d342ba0424feda9ef6c6cd9c00d | Carter Green | 2023-05-31T16:59:56 | api: add Writer::get_ref
This matches an equivalent method on csv::Reader.
We hold on on the 'get_mut' method as I have not
fully thought it through. There might be footguns there.
PR #322 | diff --git a/src/writer.rs b/src/writer.rs
index 42c85c1..392c207 100644
--- a/src/writer.rs
+++ b/src/writer.rs
@@ -1068,6 +1068,11 @@ impl<W: io::Write> Writer<W> {
Ok(())
}
+ /// Return a reference to the underlying writer.
+ pub fn get_ref(&self) -> &W {
+ self.wtr.as_ref().unwrap()
+ ... | 1 | 5 | 0 |
d24eac1ede8161d40ed6ebae4d71e071cc26bbe2 | Andrew Gallant | 2023-03-13T13:26:29 | doc: make setup version independent
I'm not fiddling with this every time I do a release, and it is annoying
for PRs getting filed to do this after every release. Moreover, the
instructions with an old version are still correct, and you'll still get
the latest version of `csv` in a fresh project.
Closes #306 | diff --git a/src/lib.rs b/src/lib.rs
index eb7fe5f..314fc36 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,20 +42,12 @@ position information, configuration knobs or iterator types.
# Setup
-Add this to your `Cargo.toml`:
-
-```toml
-[dependencies]
-csv = "1.1"
-```
+Run `cargo add csv` to add the latest version o... | 1 | 4 | 12 |
e3c663eecedc2ce4a5529b9326f7e72ead796435 | Marcel Guzik | 2023-03-06T18:25:17 | api: add IntoInnerError::into_error
Currently, for code that doesn't attempt to recover from errors but just
reports the error to the caller, it's forced to return the entire
`IntoInnerError` even if all one wants is the I/O error.
This commit adds `IntoInnerError::into_error` method that consumes
`IntoInnerErro... | diff --git a/src/error.rs b/src/error.rs
index ae2a6d8..1dfe304 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -312,6 +312,15 @@ impl<W> IntoInnerError<W> {
&self.err
}
+ /// Consumes the [`IntoInnerError`] and returns the error which caused the
+ /// call to [`Writer::into_inner`](crate::Writer:... | 1 | 9 | 0 |
f29c9d7e238d467971f94a38427b2d8e227e3c47 | Luka Krmpotić | 2023-03-04T18:25:23 | doc: update tutorial.rs
This updates the output to match actual output at present.
PR #303 | diff --git a/src/tutorial.rs b/src/tutorial.rs
index 7bce7c0..8b96c09 100644
--- a/src/tutorial.rs
+++ b/src/tutorial.rs
@@ -213,9 +213,9 @@ header1,header2
foo,bar
quux,baz,foobar
$ ./target/debug/csvtutor < invalid
-StringRecord { position: Some(Position { byte: 16, line: 2, record: 1 }), fields: ["foo", "bar"] }
... | 1 | 3 | 3 |
521294f87b3e1e286829f85a34f397e007f081ed | Andrew Gallant | 2023-02-14T02:34:10 | msrv: set rust-version = 1.60 | diff --git a/Cargo.toml b/Cargo.toml
index 826ab08..baa6d41 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ categories = ["encoding", "parser-implementations"]
exclude = ["/.github", "/ci/*", "/scripts/*"]
edition = "2021"
resolver = "2"
+rust-version = "1.60"
[workspace]
members = ["csv-core", "csv-i... | 1 | 1 | 0 |
a0e83883e2f862103edf42b130639cba50fb02f3 | Andrew Gallant | 2023-02-14T02:26:16 | deps: drop 'bstr'
It's now just a dev dependency. It wasn't really carrying its weight. | diff --git a/Cargo.toml b/Cargo.toml
index 3648469..826ab08 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ license = "Unlicense/MIT"
categories = ["encoding", "parser-implementations"]
exclude = ["/.github", "/ci/*", "/scripts/*"]
edition = "2021"
+resolver = "2"
[workspace]
members = ["csv-core", "c... | 4 | 120 | 14 |
9e1126a3f42574cafd31b2309ce686b66444e865 | Andrew Gallant | 2023-02-14T02:08:00 | cargo: update some fields | diff --git a/Cargo.toml b/Cargo.toml
index cac31de..3648469 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,14 +3,14 @@ name = "csv"
version = "1.1.6" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Fast CSV parsing with support for serde."
-documentation = "http://burntsushi.net/rustdoc/cs... | 1 | 2 | 2 |
d7a4f7dcc6d7d2395a194595f1fd1803fcc9d809 | Andrew Gallant | 2023-02-14T02:06:45 | rust: move to 2021 edition | diff --git a/Cargo.toml b/Cargo.toml
index 70a1260..cac31de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ keywords = ["csv", "comma", "parser", "delimited", "serde"]
license = "Unlicense/MIT"
categories = ["encoding", "parser-implementations"]
exclude = ["/.travis.yml", "/appveyor.yml", "/ci/*", "/scrip... | 1 | 1 | 1 |
022ac05205e2a525711481e77cf8d6df2c254833 | Andrew Gallant | 2023-02-14T02:05:28 | error: drop 'source' impl
We can either write an underlying error's display string in our
own Display impl OR we can return it as a source. We can't do
both, otherwise we wind up with repeating error messages when using
today's error helper libraries (like anyhow).
Since the error types are either exposed or already ... | diff --git a/src/error.rs b/src/error.rs
index dd90173..ae2a6d8 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -133,19 +133,7 @@ impl From<Error> for io::Error {
}
}
-impl StdError for Error {
- fn source(&self) -> Option<&(dyn StdError + 'static)> {
- match *self.0 {
- ErrorKind::Io(ref e... | 1 | 2 | 18 |
9ab83111a7ec047d6542dbd23d305cb1bf0a23ef | Andrew Gallant | 2023-02-14T02:04:14 | *: better import grouping and short hand struct init | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 4ccbb96..f21ad14 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -1,15 +1,20 @@
-use std::cmp;
-use std::fmt;
-use std::iter::FromIterator;
-use std::ops::{self, Range};
-use std::result;
-
-use bstr::{BString, ByteSlice};
-use serde::de::Deserializ... | 8 | 177 | 182 |
ea0273c531b7f09fabefd6bea68c7a99d42554de | Andrew Gallant | 2023-02-14T01:48:07 | *: fix all warnings and update code | diff --git a/examples/cookbook-read-basic.rs b/examples/cookbook-read-basic.rs
index a69b0e2..c7d4c4a 100644
--- a/examples/cookbook-read-basic.rs
+++ b/examples/cookbook-read-basic.rs
@@ -1,6 +1,4 @@
-use std::error::Error;
-use std::io;
-use std::process;
+use std::{error::Error, io, process};
fn example() -> Resu... | 36 | 96 | 221 |
41c71ed353a71526c52633d854466c1619dacae4 | Bruce Mitchener | 2021-12-16T12:50:09 | deps: update to itoa 1
PR #255 | diff --git a/Cargo.toml b/Cargo.toml
index 628e8cd..4629ede 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ bench = false
[dependencies]
bstr = { version = "0.2.1", features = ["serde1"] }
csv-core = { path = "csv-core", version = "0.1.6" }
-itoa = "0.4.3"
+itoa = "1"
ryu = "1"
serde = "1.0.55" | 1 | 1 | 1 |
40ea4c49d7467d2b607a6396424f8e0e101adae1 | Mark Lodato | 2021-04-15T15:46:24 | doc: fix a few small typos
PR #230 | diff --git a/src/writer.rs b/src/writer.rs
index a329d8d..0577c60 100644
--- a/src/writer.rs
+++ b/src/writer.rs
@@ -478,7 +478,7 @@ impl WriterBuilder {
}
}
-/// A already configured CSV writer.
+/// An already configured CSV writer.
///
/// A CSV writer takes as input Rust values and writes those values in ... | 1 | 3 | 3 |
73cf38b829e64197b2c40ede3c89a88789fa4c0b | Andrew Gallant | 2021-03-07T13:33:51 | perf: fix record copying performance bug
If there happens to be an abnormally long record in a CSV file---where
the rest are short---this abnormally long record ends up causing a
performance loss while parsing subsequent records. Such a thing is
usually caused by a buffer being expanded, and then that expanded buffer
... | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 777526e..4ccbb96 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -497,6 +497,18 @@ impl ByteRecord {
&self.0.fields[..self.0.bounds.end()]
}
+ /// Clone this record, but only copy `fields` up to the end of bounds. This
+ /// is... | 3 | 24 | 4 |
6623d87f413a8120b5d84f20ea27b275e500e6c6 | Jean SIMARD | 2021-01-26T16:10:31 | doc: fix a few typos in Writer::serialize
PR #220 | diff --git a/src/writer.rs b/src/writer.rs
index 6ab442f..a329d8d 100644
--- a/src/writer.rs
+++ b/src/writer.rs
@@ -777,7 +777,7 @@ impl<W: io::Write> Writer<W> {
/// ## Non-Struct Containers
///
/// Nested containers are flattened to their scalar components, with the
- /// exeption of a few types th... | 1 | 2 | 2 |
b08b3e6bdf7d6a2ca642516dc60ff3bd640e1aac | Michal Srb | 2020-11-27T16:11:42 | serde: skipping unused fields, don't check UTF-8
When the deserializer skips unused fields, we don't have to convert
them to valid Utf-8 string. This will prevent errors when unused fields
are not UTF-8. Removing the check may also improve performance.
See also: #198
PR #203 | diff --git a/src/deserializer.rs b/src/deserializer.rs
index 5df807b..4ee1a67 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -557,7 +557,7 @@ impl<'a, 'de: 'a, T: DeRecord<'de>> Deserializer<'de>
// Read and drop the next field.
// This code is reached, e.g., when trying to deserialize ... | 1 | 1 | 1 |
d1a69a0bf13317b845b618cebdae4aa7f9d851b8 | Ten0 | 2020-11-03T16:57:32 | api: iteration should stop after I/O error
This commit changes the behavior of the CSV reader (and its iterators)
to stop when an I/O error from the underlying reader is encountered.
When reading and parsing a record fails, correct behavior in most cases
to keep on trying to read and parse the next record. That b... | diff --git a/src/reader.rs b/src/reader.rs
index dce47b4..da53265 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -686,6 +686,10 @@ impl ReaderBuilder {
/// [`ReaderBuilder`](struct.ReaderBuilder.html).
/// * When reading CSV data from a resource (like a file), it is possible for
/// reading from the underlyin... | 2 | 63 | 9 |
71201147b6e10abaeaf72a8dc3438e38802199f6 | Nikhil Benesch | 2020-11-03T15:39:34 | api: impl Clone for ByteRecordIter and StringRecordIter
Cloneable iterators are useful when writing code that is generic over
iterators that needs to be able to iterate twice.
PR #204 | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 42edb0d..777526e 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -761,6 +761,7 @@ impl<T: AsRef<[u8]>> Extend<T> for ByteRecord {
///
/// The `'r` lifetime variable refers to the lifetime of the `ByteRecord` that
/// is being iterated over.
+#[de... | 2 | 2 | 0 |
f0f53a49f895a4046b8027df6068901d572e6a00 | Eli Flanagan | 2020-05-22T14:39:49 | doc: fix typo in tutorial
PR #201 | diff --git a/src/tutorial.rs b/src/tutorial.rs
index 3ec8c2a..9d5e607 100644
--- a/src/tutorial.rs
+++ b/src/tutorial.rs
@@ -1221,7 +1221,7 @@ To understand the type signature, we can break it down piece by piece.
2. `self` is a special parameter that corresponds to the `Writer` itself.
3. `record` is the CSV record ... | 1 | 1 | 1 |
e1578eb54971b1aa181cda6e26031e1a5ef514ac | Andrew Gallant | 2020-05-05T20:51:08 | style: run latest version of rustfmt
There appear to be some small tweaks. This hopefully fixes CI errors. | diff --git a/src/deserializer.rs b/src/deserializer.rs
index 25150c2..5df807b 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -335,15 +335,14 @@ macro_rules! deserialize_int {
visitor: V,
) -> Result<V::Value, Self::Error> {
let field = self.next_field()?;
- l... | 1 | 6 | 7 |
70c8600b29349f9ee0501577284d8300ae9c8055 | Andrew Gallant | 2020-02-14T18:08:59 | csv-core-0.1.10 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 89958cf..110ee06 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.9" #:version
+version = "0.1.10" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones... | 1 | 1 | 1 |
d8eae7b4be85856e8bd1154a1c942843027c7a61 | Pyry Kontio | 2020-02-14T18:06:54 | core/doc: correct Writer::delimiter guarantee
Previously, the docs said it only ever writes at most 1 byte. However,
if delimiter is called while quoting, then it may write the end of the quote
as well.
PR #192 | diff --git a/csv-core/src/writer.rs b/csv-core/src/writer.rs
index d3ce1a1..4f94301 100644
--- a/csv-core/src/writer.rs
+++ b/csv-core/src/writer.rs
@@ -313,7 +313,8 @@ impl Writer {
/// a field delimiter, then nothing is written to `output`
/// and `WriteResult::OutputFull` is returned. Otherwise,
/// `... | 1 | 2 | 1 |
c283b575b68b9c45a0ae94debda1eb52e68fff20 | Andrew Gallant | 2020-02-13T15:05:44 | csv-core-0.1.9 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index e34dbb9..89958cf 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.8" #:version
+version = "0.1.9" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones ... | 1 | 1 | 1 |
64421f7176f91d5c9a364adf5db98cf7d8eff959 | Frank McSherry | 2020-02-13T15:05:32 | doc: fix incorrect type name in read_record docs
What appears to be the wrong enum (probably copy/paste edit miss).
PR #191 | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index c148623..dbd6dc3 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -565,8 +565,8 @@ impl Reader {
/// `ReadRecordResult`, tells the caller what to do next. For example, if
/// the entire input was read or if the output buffer... | 1 | 2 | 2 |
b047603305185d9bd4917d64ffbdc846a1f11249 | Andrew Gallant | 2020-02-13T14:14:05 | csv-core-0.1.8 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 307ca66..e34dbb9 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.7" #:version
+version = "0.1.8" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones ... | 1 | 1 | 1 |
115a6fb71c8f83e071275cd8356648a3ebe29343 | Andrew Gallant | 2020-02-13T01:54:44 | csv-core-0.1.7 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index f315557..df79741 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.6" #:version
+version = "0.1.7" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones ... | 1 | 1 | 1 |
db36da9ea06ca62c738c9b052f7fb65b49375756 | Andrew Gallant | 2020-02-13T01:53:54 | core: don't use libc by default
memchr should use the pure Rust versions now, which are AVX optimized
and competitive with glibc (at least on x86_64). | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 24d88c3..f315557 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -21,7 +21,7 @@ appveyor = { repository = "BurntSushi/rust-csv" }
bench = false
[features]
-default = ["libc"]
+default = []
libc = ["memchr/libc"]
[dependencies] | 1 | 1 | 1 |
24e6da0d15b72ef2b9ef69602d00cc7728664a55 | Andrew Gallant | 2020-01-21T12:16:07 | safety: remove 'unsafe' from internal docs
This makes things like 'rg unsafe' more precise. | diff --git a/src/string_record.rs b/src/string_record.rs
index cf37a23..0daedb1 100644
--- a/src/string_record.rs
+++ b/src/string_record.rs
@@ -618,8 +618,7 @@ impl StringRecord {
&mut self,
rdr: &mut Reader<R>,
) -> Result<bool> {
- // SAFETY: Note that despite the absence of `unsafe` in... | 1 | 1 | 2 |
a3181911382f1086c50a5508454c2ab43d2b046d | Andrew Gallant | 2020-01-21T12:15:29 | safety: add debug_assert! to check safety invariants
This just makes good sense. It was suggested by @WildCryptoFox. | diff --git a/src/string_record.rs b/src/string_record.rs
index 4b680b6..cf37a23 100644
--- a/src/string_record.rs
+++ b/src/string_record.rs
@@ -331,6 +331,7 @@ impl StringRecord {
#[inline]
pub fn get(&self, i: usize) -> Option<&str> {
self.0.get(i).map(|bytes| {
+ debug_assert!(str::from... | 1 | 4 | 0 |
7d85dceec39d9c29b9a0a1dcfbabe24deaeb5236 | WildFox | 2020-01-17T13:54:38 | api: suppress Error::description deprecation
Removing it outright is technically a breaking change, so we just leave
it in for now until csv 2.
And also use CARGO_MANMIFEST_DIR instead of directory traversal
hacks in tests. | diff --git a/src/deserializer.rs b/src/deserializer.rs
index 856c5fd..25150c2 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -738,6 +738,7 @@ impl DeserializeError {
}
impl DeserializeErrorKind {
+ #[allow(deprecated)]
fn description(&self) -> &str {
use self::DeserializeErrorKind::*... | 2 | 2 | 6 |
e2c246824c4b586a9f046eba291776b9d57227d5 | Owen Stephens | 2020-01-07T12:38:29 | csv: only flush on explicit flush call
This fixes a bug where the CSV writer was erroneously flushing the
underlying writer when its internal buffer was full. Instead, when the
internal buffer is full, it should simply write the contents of the buffer
to the underlying writer. There is no need to flush it. Indeed, ... | diff --git a/src/writer.rs b/src/writer.rs
index f408035..6ab442f 100644
--- a/src/writer.rs
+++ b/src/writer.rs
@@ -1043,7 +1043,7 @@ impl<W: io::Write> Writer<W> {
self.state.fields_written += 1;
return Ok(());
}
- WriteResult::OutputFull => se... | 1 | 54 | 4 |
7b8c812406b83a5a7bca8bde89a2a1f9f41b62f8 | Andrew Gallant | 2019-07-01T15:49:18 | serde: conditionally use 128-bit integers
Currently, there are two cases where Serde does not provide 128-bit
integers APIs: for versions of Rust older than 1.26 and when targeting
emscripten platforms. csv's MSRV is now above 1.26, so we don't care
about the former, but folks are still trying to use csv on emscripten... | diff --git a/src/deserializer.rs b/src/deserializer.rs
index df4e4b9..856c5fd 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -10,6 +10,7 @@ use serde::de::{
Error as SerdeError, IntoDeserializer, MapAccess, SeqAccess, Unexpected,
VariantAccess, Visitor,
};
+use serde::serde_if_integer128;
u... | 3 | 132 | 98 |
bd4c8198295b160b68fb5526442f0b49377f589e | ian-hamlin | 2019-04-03T19:47:01 | serde: support i128/u128
Fixes #149, Closes #150 | diff --git a/csv-core/src/writer.rs b/csv-core/src/writer.rs
index 44ffab6..d3ce1a1 100644
--- a/csv-core/src/writer.rs
+++ b/csv-core/src/writer.rs
@@ -496,7 +496,7 @@ pub fn is_non_numeric(input: &[u8]) -> bool {
// I suppose this could be faster if we wrote validators of numbers instead
// of using the act... | 4 | 112 | 10 |
eb97684f21772d75a2bfa5d20fceb638cedc1805 | Andrew Gallant | 2019-06-26T23:08:09 | error: add position method
This makes it easy to access the position in its structured form when
an error is encountered. Callers could already do this, but they would
have to do the case analysis explicitly on `ErrorKind`.
Fixes #156 | diff --git a/src/error.rs b/src/error.rs
index e6a3b17..793ad3e 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -46,6 +46,14 @@ impl Error {
_ => false,
}
}
+
+ /// Return the position for this error, if one exists.
+ ///
+ /// This is a convenience function that permits callers to e... | 1 | 23 | 0 |
e976dd1bbbfcb1d6afd58b39cb05ced2e026b23e | Andrew Gallant | 2019-06-26T23:04:21 | bstr: use bstr in more places
This gets rid of an ASCII-only complex trim routine and replaces it with
a Unicode aware version. | diff --git a/src/byte_record.rs b/src/byte_record.rs
index db5e511..42edb0d 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -1,11 +1,10 @@
-use std::ascii;
use std::cmp;
use std::fmt;
use std::iter::FromIterator;
use std::ops::{self, Range};
use std::result;
-use std::str;
+use bstr::{BString, ByteSl... | 2 | 15 | 38 |
6ac478a951bbf26676d33b25847915ca00c6f172 | Andrew Gallant | 2019-06-26T22:40:14 | deps: introduce bstr, drop serde_bytes
Since bstr subsumes serde_bytes, and we're going to use it anyway for
other things. | diff --git a/Cargo.toml b/Cargo.toml
index 1ee2a9a..a3df426 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,7 @@ members = ["csv-core", "csv-index"]
bench = false
[dependencies]
+bstr = { version = "0.2.1", features = ["serde1"] }
csv-core = { path = "csv-core", version = "0.1.4" }
itoa = "0.4.3"
ryu = "1"... | 3 | 10 | 11 |
0c7005fd93d0aaf158ec1161cbe99ab293aec2a2 | Andrew Gallant | 2019-06-26T22:32:57 | idioms: use pub(crate), use Error::source | diff --git a/src/byte_record.rs b/src/byte_record.rs
index d22a105..db5e511 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -12,79 +12,6 @@ use crate::deserializer::deserialize_byte_record;
use crate::error::{new_utf8_error, Result, Utf8Error};
use crate::string_record::StringRecord;
-/// Retrieve the u... | 7 | 159 | 200 |
0433c67594fd7165b347f2c65fc17be195277029 | Andrew Gallant | 2019-06-26T21:15:54 | edition: move to Rust 2018 | diff --git a/Cargo.toml b/Cargo.toml
index 00bc110..c5cf7ef 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ keywords = ["csv", "comma", "parser", "delimited", "serde"]
license = "Unlicense/MIT"
categories = ["encoding", "parser-implementations"]
exclude = ["/.travis.yml", "/appveyor.yml", "/ci/*", "/scrip... | 47 | 103 | 99 |
b1a3ddecc2fe0f54493233fa87273557a82e4142 | Andrew Gallant | 2019-06-26T21:02:26 | serialize: fix NaN handling
We fix NaN handling by upgrading ryu to 1.0, which by default formats
NaN/non-finites for us.
Fixes #153 | diff --git a/Cargo.toml b/Cargo.toml
index 05f2b25..00bc110 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ bench = false
[dependencies]
csv-core = { path = "csv-core", version = "0.1.4" }
itoa = "0.4.3"
-ryu = "0.2.7"
+ryu = "1"
serde = "1.0.55"
[dev-dependencies]
diff --git a/src/serializer.rs b/src... | 2 | 10 | 1 |
73f6d1f1ab4b95a70ebf42d9b946378544c21545 | mwilbur | 2019-04-13T13:00:57 | serde: deserialize hexidecimal numbers
This commit causes the csv deserializer to make a good faith
attempt at detecting and parsing hexadecimal numbers.
PR #152 | diff --git a/src/deserializer.rs b/src/deserializer.rs
index 7e23681..9d1d980 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -312,14 +312,19 @@ impl<'r> DeRecord<'r> for DeByteRecord<'r> {
}
macro_rules! deserialize_int {
- ($method:ident, $visit:ident) => {
+ ($method:ident, $visit:ident, $int... | 1 | 34 | 12 |
6105a6adaff36f6af619a9e4156b2e83e7ebb956 | Andrew Gallant | 2019-04-05T00:21:40 | serialize: speed up Serde serialization quite a bit
This commit adds ryu and itoa as dependencies for fast allocation-free
float and integer serialization. This also unwinds a previous optimization
from 16a67c4a that is no longer needed because of this.
Here are the relevant before/after benchmarks:
name ... | diff --git a/Cargo.toml b/Cargo.toml
index 69c0d47..a64f0a5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,6 +24,8 @@ bench = false
[dependencies]
csv-core = { path = "csv-core", version = "0.1.4" }
+itoa = "0.4.3"
+ryu = "0.2.7"
serde = "1.0.55"
[dev-dependencies]
diff --git a/src/lib.rs b/src/lib.rs
index 1e... | 5 | 56 | 98 |
216962892ec8ea9f8df2440eb58e6e6b94b17157 | Magnus | 2019-02-12T17:18:48 | doc: fix link to Error type | diff --git a/src/lib.rs b/src/lib.rs
index ceacaaf..1e47cab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -34,7 +34,7 @@ and
For data that may be invalid UTF-8, `ByteRecord` is suitable.
Finally, the set of errors is described by the
-[`Error`](enum.Error.html)
+[`Error`](struct.Error.html)
type.
The rest of the ... | 1 | 1 | 1 |
a0ac79602c29e6bb804ba051360c444d190372e4 | Andrew Gallant | 2019-01-27T17:48:42 | fmt: line wrapping | diff --git a/src/error.rs b/src/error.rs
index f591503..6a91261 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -118,7 +118,9 @@ impl StdError for Error {
match *self.0 {
ErrorKind::Io(ref err) => err.description(),
ErrorKind::Utf8 { ref err, .. } => err.description(),
- Er... | 3 | 77 | 22 |
d8e58750eb9a90ed92ec7f04860ec0846e523fbf | Andrew Gallant | 2019-01-27T17:16:08 | api: allow deprecated use of 'cause'
... because we don't want to bump our MSRV just to fix this. | diff --git a/src/error.rs b/src/error.rs
index 7eb3429..f591503 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -313,6 +313,7 @@ impl<W: ::std::any::Any> StdError for IntoInnerError<W> {
self.err.description()
}
+ #[allow(deprecated)]
fn cause(&self) -> Option<&StdError> {
self.err.caus... | 1 | 1 | 0 |
23fb0cd676bf71c23fc8de45856cbf0187627e45 | Andrew Gallant | 2018-12-16T13:07:14 | csv: fix record equality, redux
This commit fixes a bug in the fix for #138, where it was possible for
two records of different lengths to compare as equal. We fix that and also
re-arrange the regression tests to be more consistent with how other
tests are structured.
Thanks to @niklasf for reporting this:
https://gi... | diff --git a/src/byte_record.rs b/src/byte_record.rs
index da3021d..f0ae296 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -109,6 +109,9 @@ pub struct ByteRecord(Box<ByteRecordInner>);
impl PartialEq for ByteRecord {
fn eq(&self, other: &ByteRecord) -> bool {
+ if self.len() != other.len() {... | 3 | 46 | 22 |
efc4a51224dd6ccb1b1c4e2254a1ea94b9067b17 | aedoq | 2018-12-16T00:48:15 | csv: fix equality check for raw records
This commit fixes the equality check for the StringRecord and
ByteRecord types such that the field boundaries are respected.
That is, [123, 4] should not be equal to [1, 234], but these
previously were treated as equivalent.
Fixes #138 | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 077bf0a..da3021d 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -109,7 +109,7 @@ pub struct ByteRecord(Box<ByteRecordInner>);
impl PartialEq for ByteRecord {
fn eq(&self, other: &ByteRecord) -> bool {
- self.as_slice() == other.as_sl... | 3 | 25 | 2 |
3518426bf9f085b64818537fffa861868bbc18ca | Andrew Gallant | 2018-12-15T15:15:27 | fixup: remove commented out code
Thanks @matklad! | diff --git a/src/deserializer.rs b/src/deserializer.rs
index 23c9295..7e23681 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -415,8 +415,6 @@ impl<'a, 'de: 'a, T: DeRecord<'de>> Deserializer<'de>
) -> Result<V::Value, Self::Error> {
self.next_field_bytes()
.and_then(|f| visitor... | 1 | 0 | 2 |
52c062029db8baf483ac077881104aa9b94cc20d | Andrew Gallant | 2018-12-15T14:54:30 | csv-core-0.1.5 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index 8580f7e..f40f96f 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.4" #:version
+version = "0.1.5" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones ... | 1 | 1 | 1 |
a5745baa172d50679e34b33d6dba3d063eb40cd4 | Andrew Gallant | 2018-12-15T14:51:32 | csv-core: fix comment handling
This commit fixes a bug in how comments were interpreted. In particular,
this causes the behavior to match the documentation, which is correct.
Comments should only be allowed at the beginning of a record, but the
parser permitted them to also appear at the beginning of a field. This
cor... | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index fc52a4a..3ac2c3c 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -990,6 +990,8 @@ impl Reader {
StartRecord => {
if self.term.equals(c) {
(StartRecord, NfaInputAction::Discard)
+ ... | 1 | 6 | 2 |
3a4ed9a36c42cea7589f4f08608bcd9b3b5128bf | Andrew Gallant | 2018-12-15T14:44:28 | fixup: support older Rust versions
We need to make sure the 'serde_bytes' name is in scope. | diff --git a/src/deserializer.rs b/src/deserializer.rs
index fb0e6b3..23c9295 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -754,7 +754,7 @@ mod tests {
use std::collections::HashMap;
use serde::de::DeserializeOwned;
- use serde_bytes::ByteBuf;
+ use serde_bytes::{self, ByteBuf};
... | 1 | 1 | 1 |
497c15b46726697688cd63a74ed335a46da95fc9 | Andrew Gallant | 2018-12-15T14:40:37 | doc: elaborate on weasel word
This commit elaborates on the cases in which you would want to use the
raw record APIs in addition to using Serde.
Thanks to @dcarosone for prompting this fix in:
https://users.rust-lang.org/t/csv-serde-vs-non-utf8-easily/23262 | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 85286b9..077bf0a 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -94,7 +94,13 @@ pub fn eq<I, T>(record: &ByteRecord, other: I) -> bool
/// it.
///
/// If you are using the Serde (de)serialization APIs, then you probably never
-/// need to intera... | 2 | 14 | 2 |
9e644e66db0aa0b931758de1c2b7da555fb632b7 | Andrew Gallant | 2018-12-15T14:27:07 | serde: fix bug in handling of invalid UTF-8
This fixes a bug that was tripped if one tried to use Serde to
deserialize records that are not valid UTF-8. In particular, given a
struct like the following:
#[derive(Debug, Deserialize)]
struct Row {
h1: String,
#[serde(with = "serde_bytes")]
... | diff --git a/src/deserializer.rs b/src/deserializer.rs
index dbfe7f4..fb0e6b3 100644
--- a/src/deserializer.rs
+++ b/src/deserializer.rs
@@ -413,8 +413,10 @@ impl<'a, 'de: 'a, T: DeRecord<'de>> Deserializer<'de>
self,
visitor: V,
) -> Result<V::Value, Self::Error> {
- self.next_field()
- ... | 1 | 32 | 2 |
7ade77518e461b222cb32612ec56404c8c91dbd3 | Igor Gnatenko | 2018-09-25T11:03:46 | crates.io: exclude unneeded files
PR #134 | diff --git a/Cargo.toml b/Cargo.toml
index 8e69ce9..75c57cf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,7 @@ readme = "README.md"
keywords = ["csv", "comma", "parser", "delimited", "serde"]
license = "Unlicense/MIT"
categories = ["encoding", "parser-implementations"]
+exclude = ["/.travis.yml", "/appveyor.... | 1 | 1 | 0 |
546291a0095a2537f48470f6e79bd82ddf299291 | Josh Stone | 2018-08-30T23:51:27 | bench: chmod -x benches/bench.rs
The mode was changed in commit cddabebe63f5, probably because an editor
was trying to be smart with the first line that looks like a shebang.
PR #128 | diff --git a/benches/bench.rs b/benches/bench.rs
old mode 100755
new mode 100644 | 1 | 0 | 0 |
16a67c4af1496dd75f165c87f166c3736a457457 | Huon Wilson | 2018-08-23T05:43:06 | csv: add SingleFieldWriter for progressive (== faster) serialization
This struct is an implementation detail that allows for progressive
writing of a field into a writer's internal buffer, which means it can
be used as a fmt::Write-r (i.e. with write!), and thus avoid more
temporary allocations with integers and arbit... | diff --git a/src/serializer.rs b/src/serializer.rs
index 6ac4744..b35bb59 100644
--- a/src/serializer.rs
+++ b/src/serializer.rs
@@ -1,4 +1,4 @@
-use std::fmt;
+use std::fmt::{self, Write};
use std::io;
use std::mem;
@@ -11,7 +11,7 @@ use serde::ser::{
};
use error::{Error, ErrorKind, new_error};
-use writer::W... | 2 | 84 | 29 |
cddabebe63f5c016e6ae4774cc5d69d48f1f6a66 | Huon Wilson | 2018-08-23T05:41:28 | Add benchmarks for serialization.
Current performance:
test count_game_serialize_owned_bytes ... bench: 14,281,542 ns/iter (+/- 2,073,319) = 154 MB/s
test count_game_serialize_owned_str ... bench: 14,325,692 ns/iter (+/- 1,240,238) = 153 MB/s
test count_mbta_serialize_owned_bytes ... be... | diff --git a/benches/bench.rs b/benches/bench.rs
old mode 100644
new mode 100755
index 3272a9c..de1b2e7
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -11,7 +11,7 @@ use std::io;
use serde::de::DeserializeOwned;
use test::Bencher;
-use csv::{ByteRecord, Reader, ReaderBuilder, StringRecord, Writer, Trim};
+use csv... | 1 | 83 | 13 |
3ccc191f82e3d5fe77929d5e414678bc2d1a20db | Matt Brubeck | 2018-07-16T20:47:54 | cookbook: fix link
PR #120 | diff --git a/src/cookbook.rs b/src/cookbook.rs
index b584ac1..904a199 100644
--- a/src/cookbook.rs
+++ b/src/cookbook.rs
@@ -71,7 +71,7 @@ This is like the previous example, except it shows how to deserialize each
record into a struct type that you define.
For more examples and details on how Serde deserialization ... | 1 | 1 | 1 |
2a7f33ae25fd3e2067e153c829d61aab4c380ece | Andrew Gallant | 2018-05-12T17:18:00 | csv: add tests for flattened deserialization
This requires the latest serde, 1.0.55, which includes a relevant bug
fix to make this work.
Closes #93 | diff --git a/Cargo.toml b/Cargo.toml
index cda82ea..7582cc9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,11 +23,11 @@ bench = false
[dependencies]
csv-core = { path = "csv-core", version = "0.1.4" }
-serde = "1.0.7"
+serde = "1.0.55"
[dev-dependencies]
-serde_derive = "1"
-serde_bytes = "0.10"
+serde_derive =... | 2 | 34 | 3 |
b7360c541d4b53a7e751cf4f3d0997f793fdb46b | Andrew Gallant | 2018-05-12T13:58:00 | csv-index 0.1.5 | diff --git a/csv-index/Cargo.toml b/csv-index/Cargo.toml
index bba8a32..18303fa 100644
--- a/csv-index/Cargo.toml
+++ b/csv-index/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-index"
-version = "0.1.4" #:version
+version = "0.1.5" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "On dis... | 1 | 1 | 1 |
d08388b9d8c6e00e7acc139619a55a8133a9510d | Michael Edwards | 2017-11-05T16:36:27 | reading: provide trim functionality
This commit adds support for trimming CSV records. There are two levels
of support:
1. Both `ByteRecord` and `StringRecord` have grown `trim` methods. A
`ByteRecord` trims ASCII whitespace while a `StringRecord` trims
Unicode whitespace.
2. The CSV reader can now be c... | diff --git a/benches/bench.rs b/benches/bench.rs
index 637771b..3272a9c 100644
--- a/benches/bench.rs
+++ b/benches/bench.rs
@@ -11,7 +11,7 @@ use std::io;
use serde::de::DeserializeOwned;
use test::Bencher;
-use csv::{ByteRecord, Reader, ReaderBuilder, StringRecord, Writer};
+use csv::{ByteRecord, Reader, ReaderBu... | 5 | 457 | 6 |
9030a4a5f3c04cfecea69cca5b934c589f81427e | Igor Gnatenko | 2018-01-27T12:33:27 | csv-core/deps: update arrayvec to 0.4
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com> | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index b36437f..8580f7e 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -27,4 +27,4 @@ libc = ["memchr/libc"]
memchr = { version = "2", default-features = false }
[dev-dependencies]
-arrayvec = { version = "0.3", default-features = false }
+arrayve... | 1 | 1 | 1 |
48db4bfb4ec523e2345edb49e375f08fbd0a20f4 | Andrew Gallant | 2018-01-01T14:59:38 | csv-core-0.1.4 | diff --git a/csv-core/Cargo.toml b/csv-core/Cargo.toml
index d29da0b..980f101 100644
--- a/csv-core/Cargo.toml
+++ b/csv-core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-core"
-version = "0.1.3" #:version
+version = "0.1.4" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Bare bones ... | 1 | 1 | 1 |
11e45d853887afe0e7e88b517fb2dc7f07fa4f6f | Anna Liao | 2017-11-05T12:34:37 | fix dead links in tutorial
Updated links for uspop-null.csv and uspop-latin1.csv | diff --git a/src/tutorial.rs b/src/tutorial.rs
index 2fa0f8f..242244d 100644
--- a/src/tutorial.rs
+++ b/src/tutorial.rs
@@ -1050,7 +1050,7 @@ the data is slightly messier than what we've been using. You can get it like
so:
```text
-$ curl -LO 'https://raw.githubusercontent.com/BurntSushi/rust-csv/rewrite/examples/... | 1 | 2 | 2 |
0aa597cd533ed3e9555a214a5cc21c7d7cdafe45 | Andrew Gallant | 2017-10-30T21:45:32 | csv-core: add escape test
This test is from: https://github.com/BurntSushi/xsv/issues/105
Note that this test never failed. The bug was further up the stack in xsv. | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index 95158a7..fc52a4a 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -1591,6 +1591,15 @@ mod tests {
parses_to!(quote_escapes_change, r#""az"b""#, csv![[r#"a"b"#]],
|b: &mut ReaderBuilder| { b.escape(Some(b'z')); });... | 1 | 9 | 0 |
f857b24a8fdc866af0ac8355e57e0943b61a8a29 | Andrew Gallant | 2017-10-30T21:45:05 | csv-core: fix mutability warnings | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index 423e31c..95158a7 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -1666,7 +1666,7 @@ mod tests {
use ReadFieldResult::*;
let mut inp = b("fooquux");
- let mut out = &mut [0; 2];
+ let out = &mut [0; 2... | 2 | 25 | 25 |
9e6fb65a2cd2621f5b26ee9e8d2ec42dddea5e6e | Jim Turner | 2017-10-13T21:14:26 | Fix alignment of examples in docstrings
This is necessary for the Markdown headings to render correctly. | diff --git a/src/lib.rs b/src/lib.rs
index dd9909d..f26ce3f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -331,9 +331,9 @@ impl Default for Terminator {
/// # fn main() { example().unwrap(); }
/// fn example() -> Result<(), Box<Error>> {
/// let data = "\
-///a,b,c
-///5,\"\",xyz
-///";
+/// a,b,c
+/// 5,\"\",xyz
... | 3 | 106 | 106 |
bc43a9634b581de3f2edeabdac47657593f6d2a2 | Andrew Gallant | 2017-10-13T20:23:30 | csv: fix mutability warnings | diff --git a/src/byte_record.rs b/src/byte_record.rs
index 5429b8c..003b89e 100644
--- a/src/byte_record.rs
+++ b/src/byte_record.rs
@@ -19,7 +19,7 @@ pub fn as_parts(
) -> (&mut Vec<u8>, &mut Vec<usize>) {
// TODO(burntsushi): Use `pub(crate)` when it stabilizes.
// (&mut record.fields, &mut record.bounds.e... | 3 | 3 | 3 |
db35a5ca7b034c9ce2f0c364d4f550ca548f804a | Jim Turner | 2017-10-13T20:19:59 | csv/writer: implement serialize for collections of structs | diff --git a/src/serializer.rs b/src/serializer.rs
index caed4ee..6ac4744 100644
--- a/src/serializer.rs
+++ b/src/serializer.rs
@@ -1,5 +1,6 @@
use std::fmt;
use std::io;
+use std::mem;
use serde::ser::{
Error as SerdeError,
@@ -14,35 +15,12 @@ use writer::Writer;
/// Serialize the given value to the give... | 2 | 811 | 178 |
6ca9dce06d57af696d9ddcc99cd85aa8f1dc66ff | Danny George | 2017-08-02T15:07:48 | fixing link to csv data file | diff --git a/src/tutorial.rs b/src/tutorial.rs
index 6107088..24c1eec 100644
--- a/src/tutorial.rs
+++ b/src/tutorial.rs
@@ -124,7 +124,7 @@ will use this same CSV data throughout the entire tutorial.) To get the data,
download it from github:
```text
-$ curl -LO 'https://raw.githubusercontent.com/BurntSushi/rust-c... | 1 | 1 | 1 |
cc3795404b891832ab644c4980bba0012ab3dc50 | Andrew Gallant | 2017-07-26T01:27:16 | csv-index 0.1.3 | diff --git a/csv-index/Cargo.toml b/csv-index/Cargo.toml
index 9cdb6ab..a2db8dd 100644
--- a/csv-index/Cargo.toml
+++ b/csv-index/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csv-index"
-version = "0.1.2" #:version
+version = "0.1.3" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "On dis... | 1 | 1 | 1 |
3aaef03e904ed76d44e19ca7bceed923b079e3f1 | Andrew Gallant | 2017-07-26T01:24:22 | csv-core 0.1.3
This also removes csv-core as a dependency from csv-index, since it is
unnecessary. | diff --git a/Cargo.toml b/Cargo.toml
index 0596880..ba08375 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ appveyor = { repository = "BurntSushi/rust-csv" }
bench = false
[dependencies]
-csv-core = { path = "csv-core", version = "0.1.2" }
+csv-core = { path = "csv-core", version = "0.1.3" }
serde = "1.... | 4 | 2 | 4 |
12a87a7209d87e6c774074816af8675fc98b5d89 | Andrew Gallant | 2017-07-26T01:11:00 | csv: add quoting flag
The threads the new 'quoting' flag from csv-core up to the csv crate. | diff --git a/src/reader.rs b/src/reader.rs
index ed1a867..afa1c6b 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -473,6 +473,45 @@ impl ReaderBuilder {
self
}
+ /// Enable or disable quoting.
+ ///
+ /// This is enabled by default, but it may be disabled. When disabled,
+ /// quotes are n... | 1 | 39 | 9 |
9209d045f5a2b07f1e1953306f58c3363561e695 | Andrew Gallant | 2017-07-26T01:06:25 | csv-core: add quoting flag
The quoting flag permits callers to completely disable quoting when
parsing CSV. | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index d2c6363..423e31c 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -112,6 +112,9 @@ pub struct Reader {
double_quote: bool,
/// If enabled, lines beginning with this byte are ignored.
comment: Option<u8>,
+ /// If ena... | 1 | 25 | 8 |
50801c90820dafeab1aae54ce9ff77d09dab0387 | Andrew Gallant | 2017-07-26T01:05:55 | formatting | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index c309220..d2c6363 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -392,8 +392,9 @@ enum NfaInputAction {
Epsilon,
// Copy input byte to a caller-provided output buffer
CopyToOutput,
- // Consume but do not copy input... | 1 | 9 | 4 |
29e23bce85306de681cdf9ce6456b84017343d6b | Paul Kernfeld | 2017-06-29T13:49:13 | Strip BOM from start of data
Fixes #81 | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index 97490e8..c309220 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -119,6 +119,8 @@ pub struct Reader {
use_nfa: bool,
/// The current line number.
line: u64,
+ /// Whether this parser has ever read anything.
+ has... | 1 | 34 | 4 |
bd80bdd39546b43e96e0c7eb1b67a08c64fd4241 | Evin Robertson | 2017-06-10T19:54:55 | Remove comment about not an NFA | diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs
index d6a76d7..97490e8 100644
--- a/csv-core/src/reader.rs
+++ b/csv-core/src/reader.rs
@@ -933,9 +933,6 @@ impl Reader {
/// This returns the next NFA state along with an NfaInputAction that
/// indicates what should be done with the input byte (no... | 1 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.