Struct csv_sniffer::Sniffer
source · [−]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
sourceimpl Sniffer
impl Sniffer
sourcepub fn header(&mut self, header: Header) -> &mut Sniffer
pub fn header(&mut self, header: Header) -> &mut Sniffer
Specify the header type (whether the CSV file has a header row, and where the data starts).
sourcepub fn quote(&mut self, quote: Quote) -> &mut Sniffer
pub fn quote(&mut self, quote: Quote) -> &mut Sniffer
Specify the quote character (if any), and whether two quotes in a row as to be interepreted as an escaped quote.
sourcepub fn sample_size(&mut self, sample_size: SampleSize) -> &mut Sniffer
pub fn sample_size(&mut self, sample_size: SampleSize) -> &mut Sniffer
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 readering 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 readering errors, or on an error examining the file.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Sniffer
impl Send for Sniffer
impl Sync for Sniffer
impl Unpin for Sniffer
impl UnwindSafe for Sniffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more