Enum DecodeError

pub enum DecodeError

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 are invalid, as they may only be present as the last 0-2 bytes of input.

This error may also indicate that extraneous trailing input bytes are present, causing otherwise valid padding to no longer be the last bytes of input.

InvalidLength(usize)

The length of the input, as measured in valid base64 symbols, is invalid. There must be 2-4 symbols in the last input quad.

InvalidLastSymbol { offset: usize, symbol: u8, symbol_value: 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 DecodeError::InvalidByte, which reports symbols that aren't in the alphabet, this error is for symbols that are in the alphabet but represent nonsensical encodings.

See crate::engine::GeneralPurposeConfig::with_decode_allow_trailing_bits to control whether to detect this encoding error and produce this variant.

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

impl Clone for DecodeError

fn clone(&self) -> DecodeError

impl Debug for DecodeError

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Display for DecodeError

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for DecodeError

impl Error for DecodeError

impl PartialEq for DecodeError

fn eq(&self, other: &DecodeError) -> bool

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 UnsafeUnpin for DecodeError

impl UnwindSafe for DecodeError

Blanket Implementations

impl<T> Any for DecodeError where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for DecodeError where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for DecodeError where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for DecodeError where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for DecodeError

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for DecodeError where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for DecodeError where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for DecodeError where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for DecodeError where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for DecodeError where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>