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§
source§impl Decoder
impl Decoder
sourcepub const fn custom(alphabet: &'static str) -> Self
pub const fn custom(alphabet: &'static 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 Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)