pub enum Utf8Error {
InvalidCodepoint(u32),
InvalidEncoding(Vec<u8>),
OverlongEncoding(Vec<u8>),
Truncated(Vec<u8>),
}
Expand description
The errors that can occur when decoding UTF-8.
Variants§
InvalidCodepoint(u32)
The codepoint is not a valid Unicode codepoint.
InvalidEncoding(Vec<u8>)
The encoding is not valid UTF-8.
OverlongEncoding(Vec<u8>)
The encoding is “overlong,” e.g., a two-byte UTF-8 encoding of a codepoint that could be encoded in a single byte. This is not allowed in UTF-8 for security reasons.
Truncated(Vec<u8>)
The character was truncated when being decoded.
Trait Implementations§
Source§impl Error for Utf8Error
impl Error for Utf8Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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()
impl Eq for Utf8Error
impl StructuralPartialEq for Utf8Error
Auto Trait Implementations§
impl Freeze for Utf8Error
impl RefUnwindSafe for Utf8Error
impl Send for Utf8Error
impl Sync for Utf8Error
impl Unpin for Utf8Error
impl UnwindSafe for Utf8Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more