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.