csv_sanity::cli

Struct CsvOptions

Source
pub struct CsvOptions {
    pub delimiter: u8,
    pub record_terminator: RecordTerminator,
    pub quote: u8,
    pub escape: Option<u8>,
    pub double_quote: bool,
}
Expand description

Cli configuration options specific to how to parse the CSV file.

CsvOptions implements Default with the following defaults:

extern crate csv;
use csv_sanity::cli::CsvOptions;
use csv::RecordTerminator;

let defaults = CsvOptions {
    delimiter: b',',
    record_terminator: csv::RecordTerminator::CRLF,
    quote: b'"',
    escape: None,
    double_quote: true,
};
assert_eq!(defaults, Default::default());

Fields§

§delimiter: u8

Field delimeter to expect in the CSV file.

Corresponds to the csv::Reader.delimiter method.

§record_terminator: RecordTerminator

Record terminator to expect in the CSV file.

Corresponds to the csv::Reader.record_terminator method. See csv::RecordTerminator.

§quote: u8

Field quotation character to expect in the CSV file.

Corresponds to the csv::Reader.quote method.

§escape: Option<u8>

Escape character to expect in the CSV file.

Corresponds to the csv::Reader.escape method.

§double_quote: bool

Whether two adjacent quote characters should be interpreted as an escaped quote character.

Corresponds to the csv::Reader.double_quote method.

Trait Implementations§

Source§

impl Default for CsvOptions

Source§

fn default() -> CsvOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.