Enum csv::NextField [] [src]

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]

fn into_iter_result(self) -> Option<Result<&'a T>>

Transform NextField into an iterator result.

fn is_end(&self) -> bool

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

fn unwrap(self) -> &'a T

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]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.