Struct csv_core::ReaderBuilder

source ·
pub struct ReaderBuilder { /* private fields */ }
Expand description

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

Create a new builder.

Build a CSV parser from this configuration.

The field delimiter to use when parsing CSV.

The default is b','.

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.

The quote character to use when parsing CSV.

The default is b'"'.

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.

Enable double quote escapes.

This is enabled by default, but it may be disabled. When disabled, doubled quotes are not interpreted as escapes.

Enable or disable quoting.

This is enabled by default, but it may be disabled. When disabled, quotes are not treated specially.

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.

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

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.