#[non_exhaustive]pub enum Base64 {
Bcrypt,
Crypt,
ShaCrypt,
}Available on crate feature
base64 only.Expand description
Base64 encoding variants used in various MCF encodings.
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.
Bcrypt
bcrypt encoding.
./ [A-Z] [a-z] [0-9]
0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39Crypt
crypt(3) encoding.
[.-9] [A-Z] [a-z]
0x2e-0x39, 0x41-0x5a, 0x61-0x7aShaCrypt
crypt(3) Base64 encoding for the following schemes:
- sha1_crypt,
- sha256_crypt,
- sha512_crypt,
- md5_crypt
[.-9] [A-Z] [a-z]
0x2e-0x39, 0x41-0x5a, 0x61-0x7aImplementations§
Source§impl Base64
impl Base64
Sourcepub fn decode(
self,
src: impl AsRef<[u8]>,
dst: &mut [u8],
) -> Result<&[u8], B64Error>
pub fn decode( self, src: impl AsRef<[u8]>, dst: &mut [u8], ) -> Result<&[u8], B64Error>
Decode a Base64 string into the provided destination buffer.
Sourcepub fn decode_vec(self, input: &str) -> Result<Vec<u8>, B64Error>
Available on crate feature alloc only.
pub fn decode_vec(self, input: &str) -> Result<Vec<u8>, B64Error>
alloc only.Decode a Base64 string into a byte vector.
Sourcepub fn encode<'a>(
self,
src: &[u8],
dst: &'a mut [u8],
) -> Result<&'a str, B64Error>
pub fn encode<'a>( self, src: &[u8], dst: &'a mut [u8], ) -> Result<&'a str, B64Error>
Encode the input byte slice as Base64.
Writes the result into the provided destination slice, returning an ASCII-encoded Base64 string value.
Sourcepub fn encode_string(self, input: &[u8]) -> String
Available on crate feature alloc only.
pub fn encode_string(self, input: &[u8]) -> String
alloc only.Sourcepub fn encoded_len(self, bytes: &[u8]) -> usize
pub fn encoded_len(self, bytes: &[u8]) -> usize
Get the length of Base64 produced by encoding the given bytes.
Trait Implementations§
Source§impl Ord for Base64
impl Ord for Base64
Source§impl PartialOrd for Base64
impl PartialOrd for Base64
impl Copy for Base64
impl Eq for Base64
impl StructuralPartialEq for Base64
Auto Trait Implementations§
impl Freeze for Base64
impl RefUnwindSafe for Base64
impl Send for Base64
impl Sync for Base64
impl Unpin for Base64
impl UnwindSafe for Base64
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