From 571ea99fb04858ca5d452f308ea8027c9e00a3d6 Mon Sep 17 00:00:00 2001 From: Joel Galenson Date: Thu, 1 Apr 2021 15:42:58 -0700 Subject: Upgrade rust/crates/csv to 1.1.6 Test: make Change-Id: Idcc376cbe99e77b2dfbfdbb57681657df65d0d40 --- .cargo_vcs_info.json | 2 +- Android.bp | 10 +++++----- Cargo.toml | 2 +- Cargo.toml.orig | 2 +- LICENSE-MIT | 21 +++++++++++++++++++++ METADATA | 8 ++++---- UNLICENSE | 24 ++++++++++++++++++++++++ src/byte_record.rs | 12 ++++++++++++ src/reader.rs | 8 ++++---- src/string_record.rs | 8 ++++++++ src/writer.rs | 4 ++-- 11 files changed, 83 insertions(+), 18 deletions(-) create mode 100644 LICENSE-MIT create mode 100644 UNLICENSE 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 "] 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 "] 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 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, &mut Vec) { 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 Iterator for StringRecordsIntoIter { fn next(&mut self) -> Option> { 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> { 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 Iterator for ByteRecordsIntoIter { fn next(&mut self) -> Option> { 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> { 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 Writer { /// ## 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 Writer { /// ``` /// /// 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. -- cgit v1.2.3