Struct csv_diff::csv::Csv

source ·
pub struct Csv<R> { /* private fields */ }

Implementations§

Create a new Csv with something that can read Csv data and implements CsvReadSeek.

Example: use Csv together with CsvByteDiffLocal to compare CSV data
use csv_diff::{csv_diff::CsvByteDiffLocal, csv::Csv};
let csv_data_left = "id,name,kind\n\
                    1,lemon,fruit\n\
                    2,strawberry,fruit";
let csv_data_right = "id,name,kind\n\
                    1,lemon,fruit\n\
                    2,strawberry,fruit";

let csv_byte_diff = CsvByteDiffLocal::new()?;

let mut diff_byte_records = csv_byte_diff.diff(
    // bytes are not `Seek`able by default, but trait `CsvReadSeek` makes them seekable
    Csv::with_reader_seek(csv_data_left.as_bytes()),
    Csv::with_reader_seek(csv_data_right.as_bytes()),
)?;

let num_of_rows_different = diff_byte_records.as_slice().len();

assert_eq!(
    num_of_rows_different,
    0
);
Ok(())

Trait Implementations§

Converts to this type from the input type.

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 alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
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.