pub struct DiffByteRecords(_);
Expand description

Holds all information about the difference between two CSVs, after they have been compared with CsvByteDiffLocal.diff. CSV records that are equal are not stored in this structure.

Also, keep in mind, that differences are stored unordered (with regard to the line in the CSV). You can use DiffByteRecords.sort_by_line to sort them in-place.

See the example on CsvByteDiffLocal for general usage.

Implementations§

Sort the underlying DiffByteRecords by line.

Note that comparison is done in parallel. Therefore, without calling this method, the resulting DiffByteRecords are out of order after the comparison (with regard to their line in the original CSV).

Return the DiffByteRecords as a single slice.

Example
use csv_diff::{csv_diff::CsvByteDiffLocal, csv::Csv};
use std::collections::HashSet;
use std::iter::FromIterator;
// some csv data with a header, where the first column is a unique id
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,nut\n\
                      3,cherry,fruit";

let csv_byte_diff = CsvByteDiffLocal::new()?;

let mut diff_byte_records = csv_byte_diff.diff(
    Csv::with_reader_seek(csv_data_left.as_bytes()),
    Csv::with_reader_seek(csv_data_right.as_bytes()),
)?;

let diff_byte_record_slice = diff_byte_records.as_slice();

assert_eq!(
    diff_byte_record_slice.len(),
    2
);
Ok(())

Return an iterator over the DiffByteRecords.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.