pub struct CsvDecodeError { /* private fields */ }Expand description
An error from decoding a CSV record into a typed value.
Carries a stable kind, a human-readable message, and the
0-based record/field indices when known.
Implementations§
Source§impl CsvDecodeError
impl CsvDecodeError
Sourcepub const fn new(kind: CsvDecodeErrorKind, message: &'static str) -> Self
pub const fn new(kind: CsvDecodeErrorKind, message: &'static str) -> Self
Creates a decode error with a stable kind and an actionable message.
Sourcepub const fn field_count() -> Self
pub const fn field_count() -> Self
A record had the wrong number of fields for the target type. The
offending location is reported through the record/field indices rather
than the message, which stays a stable &'static str.
Sourcepub const fn field(message: &'static str) -> Self
pub const fn field(message: &'static str) -> Self
A field could not be parsed into the target type.
Sourcepub const fn header_mismatch() -> Self
pub const fn header_mismatch() -> Self
The header row did not match the target’s expected header.
Sourcepub const fn kind(&self) -> CsvDecodeErrorKind
pub const fn kind(&self) -> CsvDecodeErrorKind
Returns the stable error category.
Sourcepub const fn record(&self) -> Option<usize>
pub const fn record(&self) -> Option<usize>
The 0-based record index where the error occurred, if known.
Sourcepub const fn field_index(&self) -> Option<usize>
pub const fn field_index(&self) -> Option<usize>
The 0-based field index where the error occurred, if known.
Sourcepub const fn at_record(self, record: usize) -> Self
pub const fn at_record(self, record: usize) -> Self
Attaches the 0-based record index to this error.
Trait Implementations§
Source§impl Clone for CsvDecodeError
impl Clone for CsvDecodeError
Source§fn clone(&self) -> CsvDecodeError
fn clone(&self) -> CsvDecodeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CsvDecodeError
Source§impl Debug for CsvDecodeError
impl Debug for CsvDecodeError
Source§impl Display for CsvDecodeError
impl Display for CsvDecodeError
impl Eq for CsvDecodeError
Source§impl Error for CsvDecodeError
Available on crate feature std only.
impl Error for CsvDecodeError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<CsvDecodeError> for CsvFromStrError
impl From<CsvDecodeError> for CsvFromStrError
Source§fn from(error: CsvDecodeError) -> Self
fn from(error: CsvDecodeError) -> Self
Source§impl PartialEq for CsvDecodeError
impl PartialEq for CsvDecodeError
Source§fn eq(&self, other: &CsvDecodeError) -> bool
fn eq(&self, other: &CsvDecodeError) -> bool
self and other values to be equal, and is used by ==.