Skip to content

Commit

Permalink
csv-core/writer: export configuration settings.
Browse files Browse the repository at this point in the history
This makes the CSV configuration available to consumers.
  • Loading branch information
BurntSushi committed May 25, 2017
1 parent 6386542 commit f617f8f
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions csv-core/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,43 @@ impl Writer {
}
}

/// Return the delimiter used for this writer.
#[inline]
pub fn get_delimiter(&self) -> u8 {
self.delimiter
}

/// Return the terminator used for this writer.
#[inline]
pub fn get_terminator(&self) -> Terminator {
self.term
}

/// Return the quoting style used for this writer.
#[inline]
pub fn get_quote_style(&self) -> QuoteStyle {
self.style
}

/// Return the quote character used for this writer.
#[inline]
pub fn get_quote(&self) -> u8 {
self.quote
}

/// Return the escape character used for this writer.
#[inline]
pub fn get_escape(&self) -> u8 {
self.escape
}

/// Return whether this writer doubles quotes or not. When the writer
/// does not double quotes, it will escape them using the escape character.
#[inline]
pub fn get_double_quote(&self) -> bool {
self.double_quote
}

fn write(&self, data: &[u8], output: &mut [u8]) -> (WriteResult, usize) {
if data.len() > output.len() {
(WriteResult::OutputFull, 0)
Expand Down

0 comments on commit f617f8f

Please sign in to comment.