Struct CSVReader

Source
pub struct CSVReader<T>
where T: Read + Sized,
{ /* private fields */ }
Expand description

Incredibly basic CSV reader.

Has some equivalent functionality as String.split(","), except it handles quoted entries.

Implementations§

Source§

impl<T: Read + Sized> CSVReader<T>

Source

pub fn new(reader: T) -> CSVReader<T>

Create a new CSV Reader from the input. Accepts anything that implements Read

Source

pub fn dialect(reader: T, dialect: Dialect) -> CSVReader<T>

Creates a new CSV reader based on the specified dialect. Accepts any Reader and consumes it.

Source

pub fn read_line(&mut self) -> Result<Option<Vec<String>>, CSVError>

Read and parse a single line from the CSV file.

Will return [Result::Ok(None)] upon EOF. Will return [Result::Err(CSVError)] upon any I/O error. Will return [Result::Ok(Option::Some(Vec<String>))] upon success, with each element within the line separated inside of the innermost Vec<String>

Auto Trait Implementations§

§

impl<T> Freeze for CSVReader<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for CSVReader<T>
where T: RefUnwindSafe,

§

impl<T> Send for CSVReader<T>
where T: Send,

§

impl<T> Sync for CSVReader<T>
where T: Sync,

§

impl<T> Unpin for CSVReader<T>
where T: Unpin,

§

impl<T> UnwindSafe for CSVReader<T>
where T: UnwindSafe,

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> MaybeInto<U> for T
where U: MaybeFrom<T>,

Source§

fn maybe_into(self) -> Option<U>

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.