Trait base64ct::Encoding [−][src]
Base64 encoding trait.
This trait must be imported to make use of any Base64 variant defined in this crate.
Required methods
fn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8], Error>
[src]
Decode a Base64 string into the provided destination buffer.
fn decode_in_place(buf: &mut [u8]) -> Result<&[u8], InvalidEncodingError>
[src]
Decode a Base64 string in-place.
fn decode_vec(input: &str) -> Result<Vec<u8>, Error>
[src]
This is supported on crate feature
alloc
only.Decode a Base64 string into a byte vector.
fn encode<'a>(
src: &[u8],
dst: &'a mut [u8]
) -> Result<&'a str, InvalidLengthError>
[src]
src: &[u8],
dst: &'a mut [u8]
) -> Result<&'a str, InvalidLengthError>
Encode the input byte slice as Base64.
Writes the result into the provided destination slice, returning an ASCII-encoded Base64 string value.
fn encode_string(input: &[u8]) -> String
[src]
This is supported on crate feature
alloc
only.Encode input byte slice into a String
containing Base64.
Panics
If input
length is greater than usize::MAX/4
.
fn encoded_len(bytes: &[u8]) -> usize
[src]
Get the length of Base64 produced by encoding the given bytes.
WARNING: this function will return 0
for lengths greater than usize::MAX/4
!
Implementors
impl<T: Variant> Encoding for T
[src]
fn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8], Error>
[src]
fn decode_in_place(mut buf: &mut [u8]) -> Result<&[u8], InvalidEncodingError>
[src]
Decode a standard Base64 string without padding in-place.
fn decode_vec(input: &str) -> Result<Vec<u8>, Error>
[src]
fn encode<'a>(
src: &[u8],
dst: &'a mut [u8]
) -> Result<&'a str, InvalidLengthError>
[src]
src: &[u8],
dst: &'a mut [u8]
) -> Result<&'a str, InvalidLengthError>