Struct csv_core::ReaderBuilder [−][src]
Builds a CSV reader with various configuration knobs.
This builder can be used to tweak the field delimiter, record terminator
and more for parsing CSV. Once a CSV Reader
is built, its configuration
cannot be changed.
Implementations
impl ReaderBuilder
[src][−]
pub fn new() -> ReaderBuilder
[src][−]
Create a new builder.
pub fn build(&self) -> Reader
[src][−]
Build a CSV parser from this configuration.
pub fn delimiter(&mut self, delimiter: u8) -> &mut ReaderBuilder
[src][−]
The field delimiter to use when parsing CSV.
The default is b','
.
pub fn terminator(&mut self, term: Terminator) -> &mut ReaderBuilder
[src][−]
The record terminator to use when parsing CSV.
A record terminator can be any single byte. The default is a special
value, Terminator::CRLF
, which treats any occurrence of \r
, \n
or \r\n
as a single record terminator.
pub fn quote(&mut self, quote: u8) -> &mut ReaderBuilder
[src][−]
The quote character to use when parsing CSV.
The default is b'"'
.
pub fn escape(&mut self, escape: Option<u8>) -> &mut ReaderBuilder
[src][−]
The escape character to use when parsing CSV.
In some variants of CSV, quotes are escaped using a special escape
character like \
(instead of escaping quotes by doubling them).
By default, recognizing these idiosyncratic escapes is disabled.
pub fn double_quote(&mut self, yes: bool) -> &mut ReaderBuilder
[src][−]
Enable double quote escapes.
This is enabled by default, but it may be disabled. When disabled, doubled quotes are not interpreted as escapes.
pub fn quoting(&mut self, yes: bool) -> &mut ReaderBuilder
[src][−]
Enable or disable quoting.
This is enabled by default, but it may be disabled. When disabled, quotes are not treated specially.
pub fn comment(&mut self, comment: Option<u8>) -> &mut ReaderBuilder
[src][−]
The comment character to use when parsing CSV.
If the start of a record begins with the byte given here, then that line is ignored by the CSV parser.
This is disabled by default.
pub fn ascii(&mut self) -> &mut ReaderBuilder
[src][−]
A convenience method for specifying a configuration to read ASCII delimited text.
This sets the delimiter and record terminator to the ASCII unit
separator (\x1F
) and record separator (\x1E
), respectively.
Trait Implementations
impl Debug for ReaderBuilder
[src][+]
impl Default for ReaderBuilder
[src][+]
Auto Trait Implementations
impl RefUnwindSafe for ReaderBuilder
impl Send for ReaderBuilder
impl Sync for ReaderBuilder
impl Unpin for ReaderBuilder
impl UnwindSafe for ReaderBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,