Enum sqlstate_inline::ParseError
source · pub enum ParseError {
InvalidChar {
byte: u8,
position: usize,
},
WrongLength {
expected: u8,
got: usize,
},
}
Variants§
InvalidChar
The byte at index position
in the string was not a valid ASCII character in the range A-Z
,0-9
.
WrongLength
The source string didn’t have the expected length.
Implementations§
source§impl ParseError
impl ParseError
sourcepub const fn valid_up_to(&self) -> usize
pub const fn valid_up_to(&self) -> usize
Returns the index of the first invalid byte, the position of the premature end or of the first superfluous byte.
if let Err(error) = SqlState::from_str("000!0") {
let index = error.valid_up_to();
assert_eq!(index, 3);
} else {
unreachable!("this is no valid SQLSTATE code");
}
Trait Implementations§
source§impl Clone for ParseError
impl Clone for ParseError
source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ParseError
impl Debug for ParseError
source§impl Display for ParseError
impl Display for ParseError
source§impl Error for ParseError
impl Error for ParseError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<ParseError> for Error
impl From<ParseError> for Error
source§fn from(error: ParseError) -> Self
fn from(error: ParseError) -> Self
Converts a ParseError
to an std::io::Error
of kind InvalidData
for convenience.