pub trait Encoding: Alphabet {
// Required methods
fn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8]>;
fn decode_vec(input: &str) -> Result<Vec<u8>>;
fn encode<'a>(src: &[u8], dst: &'a mut [u8]) -> Result<&'a str>;
fn encode_string(input: &[u8]) -> String;
fn encoded_len(bytes: &[u8]) -> usize;
}Expand description
Core encoder/decoder functions for a particular Base32 alphabet
Required Methods§
Sourcefn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8]>
fn decode(src: impl AsRef<[u8]>, dst: &mut [u8]) -> Result<&[u8]>
Decode a Base32-encoded string into the provided output buffer, returning a slice containing the decoded data.
Sourcefn decode_vec(input: &str) -> Result<Vec<u8>>
Available on crate feature alloc only.
fn decode_vec(input: &str) -> Result<Vec<u8>>
alloc only.Decode a Base32 string into a byte vector.
Sourcefn encode<'a>(src: &[u8], dst: &'a mut [u8]) -> Result<&'a str>
fn encode<'a>(src: &[u8], dst: &'a mut [u8]) -> Result<&'a str>
Encode the input byte slice as Base32.
Writes the result into the provided destination slice, returning an ASCII-encoded Base32 string value.
Sourcefn encode_string(input: &[u8]) -> String
Available on crate feature alloc only.
fn encode_string(input: &[u8]) -> String
alloc only.Encode input byte slice into a String containing Base32.
Sourcefn encoded_len(bytes: &[u8]) -> usize
fn encoded_len(bytes: &[u8]) -> usize
Get the length of Base32 produced by encoding the given bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.