aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-04-02 17:37:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-02 17:37:49 +0000
commit6b1e96e1af193743ad4bad031785e2d1d963450c (patch)
treeb896b61a088e21510b50d6937f858254dc4beff5
parent1622dfa52c333d6d3c90cbac253935adb75fd362 (diff)
parent6c5a3de18a1e4f062247f3136961e366075ba2e0 (diff)
downloadcsv-android12L-dev.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/csv/+/1661950 Change-Id: Ifc568e66b7777c959157db42b8628d84d8c195c2
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp10
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--LICENSE-MIT21
-rw-r--r--METADATA8
-rw-r--r--UNLICENSE24
-rw-r--r--src/byte_record.rs12
-rw-r--r--src/reader.rs8
-rw-r--r--src/string_record.rs8
-rw-r--r--src/writer.rs4
11 files changed, 83 insertions, 18 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 8e89782..3af53d7 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "6e8c0a725606829054daabeec0c3e6e3a37c13f9"
+ "sha1": "d1fe79738d4948d3167f8f3331d4eed4b67c4a10"
}
}
diff --git a/Android.bp b/Android.bp
index 825a57c..49e8234 100644
--- a/Android.bp
+++ b/Android.bp
@@ -54,16 +54,16 @@ rust_library {
// dependent_library ["feature_list"]
// bstr-0.2.15 "default,lazy_static,regex-automata,serde,serde1,serde1-nostd,std,unicode"
-// byteorder-1.4.2
+// byteorder-1.4.3
// csv-core-0.1.10 "default"
// itoa-0.4.7 "default,std"
// lazy_static-1.4.0
// memchr-2.3.4 "std,use_std"
-// proc-macro2-1.0.24 "default,proc-macro"
+// proc-macro2-1.0.26 "default,proc-macro"
// quote-1.0.9 "default,proc-macro"
// regex-automata-0.1.9
// ryu-1.0.5
-// serde-1.0.123 "default,derive,serde_derive,std"
-// serde_derive-1.0.123 "default"
-// syn-1.0.61 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
+// serde-1.0.125 "default,derive,serde_derive,std"
+// serde_derive-1.0.125 "default"
+// syn-1.0.68 "clone-impls,default,derive,parsing,printing,proc-macro,quote"
// unicode-xid-0.2.1 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 6d917a9..707e4e2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "csv"
-version = "1.1.5"
+version = "1.1.6"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
exclude = ["/.travis.yml", "/appveyor.yml", "/ci/*", "/scripts/*"]
description = "Fast CSV parsing with support for serde."
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 6c2eb95..628e8cd 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "csv"
-version = "1.1.5" #:version
+version = "1.1.6" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Fast CSV parsing with support for serde."
documentation = "http://burntsushi.net/rustdoc/csv/"
diff --git a/LICENSE-MIT b/LICENSE-MIT
new file mode 100644
index 0000000..3b0a5dc
--- /dev/null
+++ b/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Andrew Gallant
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/METADATA b/METADATA
index 36505d4..472afd9 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/csv/csv-1.1.5.crate"
+ value: "https://static.crates.io/crates/csv/csv-1.1.6.crate"
}
- version: "1.1.5"
+ version: "1.1.6"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 1
- day: 6
+ month: 4
+ day: 1
}
}
diff --git a/UNLICENSE b/UNLICENSE
new file mode 100644
index 0000000..68a49da
--- /dev/null
+++ b/UNLICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
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 useful when one wants to copy a record, but not necessarily any
+ /// excess capacity in that record.
+ #[inline]
+ pub(crate) fn clone_truncated(&self) -> ByteRecord {
+ let mut br = ByteRecord::new();
+ br.0.pos = self.0.pos.clone();
+ br.0.bounds = self.0.bounds.clone();
+ br.0.fields = self.0.fields[..self.0.bounds.end()].to_vec();
+ br
+ }
+
/// Retrieve the underlying parts of a byte record.
#[inline]
pub(crate) fn as_parts(&mut self) -> (&mut Vec<u8>, &mut Vec<usize>) {
diff --git a/src/reader.rs b/src/reader.rs
index da53265..3d66eea 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -2050,7 +2050,7 @@ impl<R: io::Read> Iterator for StringRecordsIntoIter<R> {
fn next(&mut self) -> Option<Result<StringRecord>> {
match self.rdr.read_record(&mut self.rec) {
Err(err) => Some(Err(err)),
- Ok(true) => Some(Ok(self.rec.clone())),
+ Ok(true) => Some(Ok(self.rec.clone_truncated())),
Ok(false) => None,
}
}
@@ -2087,7 +2087,7 @@ impl<'r, R: io::Read> Iterator for StringRecordsIter<'r, R> {
fn next(&mut self) -> Option<Result<StringRecord>> {
match self.rdr.read_record(&mut self.rec) {
Err(err) => Some(Err(err)),
- Ok(true) => Some(Ok(self.rec.clone())),
+ Ok(true) => Some(Ok(self.rec.clone_truncated())),
Ok(false) => None,
}
}
@@ -2126,7 +2126,7 @@ impl<R: io::Read> Iterator for ByteRecordsIntoIter<R> {
fn next(&mut self) -> Option<Result<ByteRecord>> {
match self.rdr.read_byte_record(&mut self.rec) {
Err(err) => Some(Err(err)),
- Ok(true) => Some(Ok(self.rec.clone())),
+ Ok(true) => Some(Ok(self.rec.clone_truncated())),
Ok(false) => None,
}
}
@@ -2163,7 +2163,7 @@ impl<'r, R: io::Read> Iterator for ByteRecordsIter<'r, R> {
fn next(&mut self) -> Option<Result<ByteRecord>> {
match self.rdr.read_byte_record(&mut self.rec) {
Err(err) => Some(Err(err)),
- Ok(true) => Some(Ok(self.rec.clone())),
+ Ok(true) => Some(Ok(self.rec.clone_truncated())),
Ok(false) => None,
}
}
diff --git a/src/string_record.rs b/src/string_record.rs
index 4e807f2..4e758f3 100644
--- a/src/string_record.rs
+++ b/src/string_record.rs
@@ -610,6 +610,14 @@ impl StringRecord {
self.0
}
+ /// Clone this record, but only copy `fields` up to the end of bounds. This
+ /// is useful when one wants to copy a record, but not necessarily any
+ /// excess capacity in that record.
+ #[inline]
+ pub(crate) fn clone_truncated(&self) -> StringRecord {
+ StringRecord(self.0.clone_truncated())
+ }
+
/// A safe function for reading CSV data into a `StringRecord`.
///
/// This relies on the internal representation of `StringRecord`.
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 that are not allowed:
+ /// exception of a few types that are not allowed:
///
/// | Name | Example Type | Example Value | Output |
/// | ---- | ---- | ---- | ---- |
@@ -831,7 +831,7 @@ impl<W: io::Write> Writer<W> {
/// ```
///
/// However, if `has_headers` were enabled in the above example, then
- /// serialization would return an error. Speficially, when `has_headers` is
+ /// serialization would return an error. Specifically, when `has_headers` is
/// `true`, there are two restrictions:
///
/// 1. Named field values in structs must be scalars.