Encoding

Trait Encoding 

Source
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§

Source

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.

Source

fn decode_vec(input: &str) -> Result<Vec<u8>>

Available on crate feature alloc only.

Decode a Base32 string into a byte vector.

Source

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.

Source

fn encode_string(input: &[u8]) -> String

Available on crate feature alloc only.

Encode input byte slice into a String containing Base32.

Source

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.

Implementors§

Source§

impl<T: Alphabet> Encoding for T