Struct csv_core::WriterBuilder [−][src]
A builder for configuring a CSV writer.
This builder permits specifying the CSV delimiter, terminator, quoting style and more.
Implementations
impl WriterBuilder
[src]
pub fn new() -> WriterBuilder
[src]
Create a new builder for configuring a CSV writer.
pub fn build(&self) -> Writer
[src]
Builder a CSV writer from this configuration.
pub fn delimiter(&mut self, delimiter: u8) -> &mut WriterBuilder
[src]
The field delimiter to use when writing CSV.
The default is b','
.
pub fn terminator(&mut self, term: Terminator) -> &mut WriterBuilder
[src]
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.
pub fn quote_style(&mut self, style: QuoteStyle) -> &mut WriterBuilder
[src]
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.
pub fn quote(&mut self, quote: u8) -> &mut WriterBuilder
[src]
The quote character to use when writing CSV.
The default value is b'"'
.
pub fn escape(&mut self, escape: u8) -> &mut WriterBuilder
[src]
The escape character to use when writing CSV.
This is only used when double_quote
is set to false
.
The default value is b'\\'
.
pub fn double_quote(&mut self, yes: bool) -> &mut WriterBuilder
[src]
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
impl Debug for WriterBuilder
[src]
impl Default for WriterBuilder
[src]
fn default() -> WriterBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for WriterBuilder
impl Send for WriterBuilder
impl Sync for WriterBuilder
impl Unpin for WriterBuilder
impl UnwindSafe for WriterBuilder
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,