[][src]Enum csv::NextField

pub enum NextField<'a, T: ?Sized + 'a> {
    Data(&'a T),
    Error(Error),
    EndOfRecord,
    EndOfCsv,
}

NextField is the result of parsing a single CSV field.

This is only useful if you're using the low level next_bytes method.

Variants

Data(&'a T)

A single CSV field as a borrowed slice of the parser's internal buffer.

Error(Error)

A CSV error found during parsing. When an error is found, it is first returned. All subsequent calls of next_bytes will return EndOfCsv. (EOF is exempt from this. Depending on the state of the parser, an EOF could trigger Data, EndOfRecord and EndOfCsv, all in succession.)

In general, once EndOfCsv is returned, no other return value is possible on subsequent calls.

EndOfRecord

Indicates the end of a record.

EndOfCsv

Indicates the end of the CSV data. Once this state is entered, the parser can never leave it.

Methods

impl<'a, T: ?Sized + Debug> NextField<'a, T>[src]

pub fn into_iter_result(self) -> Option<Result<&'a T>>[src]

Transform NextField into an iterator result.

pub fn is_end(&self) -> bool[src]

Returns true if and only if the end of CSV data has been reached.

pub fn unwrap(self) -> &'a T[src]

Returns the underlying field data.

If NextField is an error or an end of record/CSV marker, this will panic.

Trait Implementations

impl<'a, T: Debug + ?Sized + 'a> Debug for NextField<'a, T>[src]

Auto Trait Implementations

impl<'a, T: ?Sized> Send for NextField<'a, T> where
    T: Sync

impl<'a, T: ?Sized> Sync for NextField<'a, T> where
    T: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.