pub enum Utf8ParserError {
InvalidByte(u8),
InvalidChar(u32),
UnexpectedStartByte(u8),
UnexpectedContinuationByte(u8),
OverlongEncoding,
}Expand description
Error type used for the utf8-parser crate
Variants§
InvalidByte(u8)
Encountered an invalid byte. This is a byte that’s invalid no matter the context.
InvalidChar(u32)
Found a code point that’s not valid UTF-8.
UnexpectedStartByte(u8)
Found a start byte in an unexpected place
UnexpectedContinuationByte(u8)
Found a continuation byte in an unexpected place
OverlongEncoding
Represented a valid code point in a longer form than necessary.
From Wikipedia:
The standard specifies that the correct encoding of a code point uses only the minimum number of bytes required to hold the significant bits of the code point. Longer encodings are called overlong and are not valid UTF-8 representations of the code point. This rule maintains a one-to-one correspondence between code points and their valid encodings, so that there is a unique valid encoding for each code point. This ensures that string comparisons and searches are well-defined.
Trait Implementations§
Source§impl Clone for Utf8ParserError
impl Clone for Utf8ParserError
Source§fn clone(&self) -> Utf8ParserError
fn clone(&self) -> Utf8ParserError
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 Utf8ParserError
Source§impl Debug for Utf8ParserError
impl Debug for Utf8ParserError
Source§impl Display for Utf8ParserError
impl Display for Utf8ParserError
impl Eq for Utf8ParserError
Source§impl Error for Utf8ParserError
impl Error for Utf8ParserError
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()