pub enum EncodingError {
BufferTooShort,
Malformed {
read: usize,
write: usize,
length: usize,
offset: usize,
},
Unmappable {
read: usize,
write: usize,
c: char,
},
Other {
msg: Cow<'static, str>,
},
}Variants§
BufferTooShort
The length of the output buffer is too short.
If this error is returned, it is guaranteed that the encoder/decoder is consuming the input buffer.
Malformed
Malformed byte sequence is found.
The input and output buffer have consumed read and write bytes respectively.
Malformed sequence occurs input[read-length-offset..read-offset].
Only the decoder returns this error.
Unmappable
A UTF-8 character c cannot map any codepoints of the target encoding.
The input and output buffer have consumed read and write bytes respectively.
read includes the length of c. Thus, the correctly read length is read - c.len_utf8().
write does not include the length of c because encoder cannot write unmapped characters.
Only the encoder returns this error.
Other
Other errors.
Implementations§
Source§impl EncodingError
impl EncodingError
Trait Implementations§
Source§impl Clone for EncodingError
impl Clone for EncodingError
Source§fn clone(&self) -> EncodingError
fn clone(&self) -> EncodingError
Returns a duplicate 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 EncodingError
impl Debug for EncodingError
Source§impl Display for EncodingError
impl Display for EncodingError
Source§impl Error for EncodingError
impl Error for EncodingError
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()
Auto Trait Implementations§
impl Freeze for EncodingError
impl RefUnwindSafe for EncodingError
impl Send for EncodingError
impl Sync for EncodingError
impl Unpin for EncodingError
impl UnwindSafe for EncodingError
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