#[non_exhaustive]
pub enum Decoder {
    Hex,
    Base64,
    Base64Url,
    Custom(Encoding),
}
Expand description

Decoder of a human-friendly encoding, such as hex or base64, into bytes.

Examples

See the crate docs for examples of usage.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Hex

Hexadecimal decoder. Supports uppercase and lowercase digits.

Base64

Base64 decoder accepting standard encoding as per RFC 3548. Does not require padding, but works fine with it.

Base64Url

Base64 decoder accepting URL / filesystem-safe encoding as per RFC 3548. Does not require padding, but works fine with it.

Custom(Encoding)

Decoder based on a custom Encoding.

Implementations

Creates a new decoder with a custom alphabet.

Panics

Panics in the same situations as Encoding::new().

Makes this decoder skip whitespace chars rather than panicking on encountering them.

Decodes input into a byte array.

Panics
  • Panics if the provided length is insufficient or too large for input.
  • Panics if input contains invalid chars.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.