pub struct Csv<R> { /* private fields */ }
Implementationsยง
Sourceยงimpl<R: Read + Seek + Send> Csv<R>
impl<R: Read + Seek + Send> Csv<R>
Sourcepub fn with_reader_seek<RSeek: CsvReadSeek<R>>(reader: RSeek) -> Self
pub fn with_reader_seek<RSeek: CsvReadSeek<R>>(reader: RSeek) -> Self
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ยง
Auto Trait Implementationsยง
impl<R> Freeze for Csv<R>where
R: Freeze,
impl<R> RefUnwindSafe for Csv<R>where
R: RefUnwindSafe,
impl<R> Send for Csv<R>where
R: Send,
impl<R> Sync for Csv<R>where
R: Sync,
impl<R> Unpin for Csv<R>where
R: Unpin,
impl<R> UnwindSafe for Csv<R>where
R: UnwindSafe,
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more