pub enum DecodeError {
InvalidByte(usize, u8),
InvalidLength,
InvalidLastSymbol(usize, u8),
InvalidPadding,
}
Expand description
Errors that can occur while decoding.
Variants§
InvalidByte(usize, u8)
An invalid byte was found in the input. The offset and offending byte are provided.
Padding characters (=
) interspersed in the encoded form will be treated as invalid bytes.
InvalidLength
The length of the input is invalid.
A typical cause of this is stray trailing whitespace or other separator bytes.
In the case where excess trailing bytes have produced an invalid length and the last byte
is also an invalid base64 symbol (as would be the case for whitespace, etc), InvalidByte
will be emitted instead of InvalidLength
to make the issue easier to debug.
InvalidLastSymbol(usize, u8)
The last non-padding input symbol’s encoded 6 bits have nonzero bits that will be discarded.
This is indicative of corrupted or truncated Base64.
Unlike InvalidByte
, which reports symbols that aren’t in the alphabet, this error is for
symbols that are in the alphabet but represent nonsensical encodings.
InvalidPadding
The nature of the padding was not as configured: absent or incorrect when it must be canonical, or present when it must be absent, etc.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
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
Source§impl From<DecodeError> for DecodeSliceError
impl From<DecodeError> for DecodeSliceError
Source§fn from(e: DecodeError) -> Self
fn from(e: DecodeError) -> Self
Source§impl PartialEq for DecodeError
impl PartialEq for DecodeError
impl Eq for DecodeError
impl StructuralPartialEq for DecodeError
Auto Trait Implementations§
impl Freeze for DecodeError
impl RefUnwindSafe for DecodeError
impl Send for DecodeError
impl Sync for DecodeError
impl Unpin for DecodeError
impl UnwindSafe for DecodeError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)