Enum const_decoder::Decoder
source · #[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
sourceimpl Decoder
impl Decoder
sourcepub const fn custom(alphabet: &str) -> Self
pub const fn custom(alphabet: &str) -> Self
Creates a new decoder with a custom alphabet.
Panics
Panics in the same situations as Encoding::new()
.
sourcepub const fn skip_whitespace(self) -> SkipWhitespace
pub const fn skip_whitespace(self) -> SkipWhitespace
Makes this decoder skip whitespace chars rather than panicking on encountering them.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more