Skip to content

Commit

Permalink
Change csv reader to use "trim" and "flexible".
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-hamlin committed Apr 27, 2019
1 parent ca83774 commit 80ebb2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ pub fn from_file(file_path: &PathBuf, settings: &settings::Settings) -> Result<(
let file = File::open(file_path)?;
let mut reader = csv::ReaderBuilder::new()
.has_headers(settings.has_headers())
.trim(csv::Trim::All)
.flexible(true)
.from_reader(file);

// Get the file as chunks.
while let Some(chunks) = next_chunk(settings.chunk_size(), &mut reader) {
chunks.par_iter().for_each(|record| {
if record.len() == 2 {
if record.len() >= 2 {
if let Some(qr) = generate_qr(&record[1], &settings) {
let res = write_svg(qr, &record[0], &settings);
if res.is_err() {
Expand Down

0 comments on commit 80ebb2a

Please sign in to comment.