Struct csv_sniffer::Sniffer
[−]
[src]
pub struct Sniffer { /* fields omitted */ }
A CSV sniffer.
The sniffer examines a CSV file, passed in either through a file or a reader.
Methods
impl Sniffer
[src]
pub fn new() -> Sniffer
[src]
Create a new CSV sniffer.
pub fn delimiter(&mut self, delimiter: u8) -> &mut Sniffer
[src]
Specify the delimiter character.
pub fn header(&mut self, header: Header) -> &mut Sniffer
[src]
Specify the header type (whether the CSV file has a header row, and where the data starts).
pub fn quote(&mut self, quote: Quote) -> &mut Sniffer
[src]
Specify the quote character (if any), and whether two quotes in a row as to be interepreted as an escaped quote.
pub fn sample_size(&mut self, sample_size: SampleSize) -> &mut Sniffer
[src]
The size of the sample to examine while sniffing. If using SampleSize::Records
, the
sniffer will use the value provided with terminator()
(or Terminator::CRLF
if no
terminator is provided). Thus, SampleSize::Records
may work unexpectedly for
non-CRLF-terminated files if the terminator is not provided.
The sample size defaults to SampleSize::Bytes(4096)
.
pub fn open_path<P: AsRef<Path>>(&mut self, path: P) -> Result<Reader<File>>
[src]
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.
pub fn open_reader<R: Read + Seek>(&mut self, reader: R) -> Result<Reader<R>>
[src]
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.
pub fn sniff_path<P: AsRef<Path>>(&mut self, path: P) -> Result<Metadata>
[src]
Sniff the CSV file located at the provided path, and return a
Metadata
object containing information about the CSV file.
Fails on file opening or readering errors, or on an error examining the file.
pub fn sniff_reader<R: Read + Seek>(&mut self, reader: R) -> Result<Metadata>
[src]
Sniff the CSV file provider by the reader, and return a
Metadata
object containing information about the CSV file.
Fails on file opening or readering errors, or on an error examining the file.
Trait Implementations
impl Debug for Sniffer
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more