pub struct Sniffer { /* private fields */ }
Expand description
A CSV sniffer.
The sniffer examines a CSV file, passed in either through a file or a reader.
Implementations§
Source§impl Sniffer
impl Sniffer
Sourcepub fn quote(&mut self, quote: Quote) -> &mut Self
pub fn quote(&mut self, quote: Quote) -> &mut Self
Specify the header type (whether the CSV file has a header row, and where the data starts). Specify the quote character (if any), and whether two quotes in a row as to be interpreted as an escaped quote.
Sourcepub fn sample_size(&mut self, sample_size: SampleSize) -> &mut Self
pub fn sample_size(&mut self, sample_size: SampleSize) -> &mut Self
The size of the sample to examine while sniffing. If using SampleSize::Records
, the
sniffer will use the Terminator::CRLF
as record separator.
The sample size defaults to SampleSize::Bytes(4096)
.
Sourcepub fn open_path<P: AsRef<Path>>(&mut self, path: P) -> Result<Reader<File>>
pub fn open_path<P: AsRef<Path>>(&mut self, path: P) -> Result<Reader<File>>
Sniff the CSV file located at the provided path, and return a Reader
(from the
csv
crate) ready to ready the file.
Fails on file opening or rendering errors, or on an error examining the file.
Sourcepub fn open_reader<R: Read + Seek>(&mut self, reader: R) -> Result<Reader<R>>
pub fn open_reader<R: Read + Seek>(&mut self, reader: R) -> Result<Reader<R>>
Sniff the CSV file provided by the reader, and return a csv
Reader
object.
Fails on file opening or rendering errors, or on an error examining the file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sniffer
impl RefUnwindSafe for Sniffer
impl Send for Sniffer
impl Sync for Sniffer
impl Unpin for Sniffer
impl UnwindSafe for Sniffer
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
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>
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>
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