Struct csv_core::WriterBuilder

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

A builder for configuring a CSV writer.

This builder permits specifying the CSV delimiter, terminator, quoting style and more.

Implementations

Create a new builder for configuring a CSV writer.

Builder a CSV writer from this configuration.

The field delimiter to use when writing CSV.

The default is b','.

The record terminator to use when writing CSV.

A record terminator can be any single byte. The default is \n.

Note that RFC 4180 specifies that record terminators should be \r\n. To use \r\n, use the special Terminator::CRLF value.

The quoting style to use when writing CSV.

By default, this is set to QuoteStyle::Necessary, which will only use quotes when they are necessary to preserve the integrity of data.

Note that unless the quote style is set to Never, an empty field is quoted if it is the only field in a record.

The quote character to use when writing CSV.

The default value is b'"'.

The escape character to use when writing CSV.

This is only used when double_quote is set to false.

The default value is b'\\'.

The quoting escape mechanism to use when writing CSV.

When enabled (which is the default), quotes are escaped by doubling them. e.g., " escapes to "".

When disabled, quotes are escaped with the escape character (which is \\ by default).

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.