pub enum Error {
IoError(Error),
MalformedUtf8(StreamPosition, usize),
}Expand description
Error represents an error from the UTF-8 character reader, either an IO error from the reader or a malformed UTF-8 encoded set of bytes.
Variants§
IoError(Error)
An IoError is passed through from the underlying read object.
MalformedUtf8(StreamPosition, usize)
A MalformedUtf8 error occurs when a byte stream contains invalid UTF-8; the position within the stream of the Unicode decoding error is recorded, and the number of bytes that form the invalid UTF-8 encoding (which will be from 1 to 3).
Implementations§
Source§impl Error
impl Error
Sourcepub fn malformed_utf8<T>(
stream_pos: StreamPosition,
num_bytes: usize,
) -> Result<T>
pub fn malformed_utf8<T>( stream_pos: StreamPosition, num_bytes: usize, ) -> Result<T>
Create an error for a malformed UTF8 decoding within a stream
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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