pub struct InputStreamBuilder { /* private fields */ }

Implementations

Start a transformation chain from a set of csv creaders.

This is what you need in case your CSVs are not comma separated or you need to adjust some parameters like escape character.

Example
use csvsc::prelude::*;
use csv::ReaderBuilder;
use encoding::all::UTF_8;

let mut chain = InputStreamBuilder::from_readers(vec![
    ReaderBuilder::new()
        .delimiter(b';')
        .from_path("test/assets/1.csv")
        .unwrap().into(),
    ReaderBuilder::new()
        .delimiter(b';')
        .from_path("test/assets/2.csv")
        .unwrap().into(),
]).build().unwrap();

Start a transformation chain from a set of paths in the filesystem.

This is probably the easiest way to get started. It assumes comma separated fields, double quotes as field wrap and some other sensible defaults from csv crate

Example
use csvsc::prelude::*;

let mut chain = InputStreamBuilder::from_paths(&[
    "test/assets/chicken_north.csv",
    "test/assets/chicken_south.csv",
]).unwrap().build().unwrap();

From there you can chain the methods of the RowStream trait.

Use this encoding to decode the input files

Example
use csvsc::prelude::*;
use encoding::all::WINDOWS_1252;

let mut chain = InputStreamBuilder::from_paths(&[
    "test/assets/windows1252/data.csv",
]).unwrap().with_encoding(WINDOWS_1252).build().unwrap();

Add a column with this name to every row with the path to the file where it comes from.

Example
use csvsc::prelude::*;

let mut chain = InputStreamBuilder::from_paths(&[
    "test/assets/1.csv",
]).unwrap().with_source_col("source").build().unwrap().into_iter();

assert_eq!(chain.next().unwrap().unwrap(), Row::from(vec!["1", "3", "test/assets/1.csv"]));

Build the InputStream from the parameters of this builder and return it.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.