pub trait EngineBytesExt<A, const PAD: bool>where
A: Alphabet,{
// Required methods
fn encode_bytes(
&self,
input: impl AsRef<[u8]>,
) -> Result<Bytes, EncodeError>;
fn decode_bytes(
&self,
input: impl AsRef<[u8]>,
) -> Result<Bytes, DecodeError>;
fn encode_buf<B>(&self, input: B) -> Result<Bytes, EncodeError>
where B: Buf;
fn decode_buf<B>(&self, input: B) -> Result<Bytes, DecodeError>
where B: Buf;
fn encode_buf_to_mut<B, M>(
&self,
input: B,
output: &mut M,
) -> Result<usize, EncodeError>
where B: Buf,
M: BufMut;
fn decode_buf_to_mut<B, M>(
&self,
input: B,
output: &mut M,
) -> Result<usize, DecodeError>
where B: Buf,
M: BufMut;
}Expand description
Extension helpers for base64_ng::Engine and bytes buffers.
Required Methods§
Sourcefn encode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, EncodeError>
fn encode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, EncodeError>
Sourcefn decode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, DecodeError>
fn decode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, DecodeError>
Sourcefn encode_buf<B>(&self, input: B) -> Result<Bytes, EncodeError>where
B: Buf,
fn encode_buf<B>(&self, input: B) -> Result<Bytes, EncodeError>where
B: Buf,
Encodes all remaining bytes from input into a Bytes value.
The input buffer is advanced to completion only after its current chunks have been copied into a temporary contiguous buffer.
§Errors
Returns EncodeError if the encoded length overflows.
Sourcefn decode_buf<B>(&self, input: B) -> Result<Bytes, DecodeError>where
B: Buf,
fn decode_buf<B>(&self, input: B) -> Result<Bytes, DecodeError>where
B: Buf,
Decodes all remaining bytes from input into a Bytes value.
§Errors
Returns DecodeError if decoding fails.
Sourcefn encode_buf_to_mut<B, M>(
&self,
input: B,
output: &mut M,
) -> Result<usize, EncodeError>
fn encode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, EncodeError>
Encodes all remaining bytes from input into output.
§Errors
Returns EncodeError::OutputTooSmall if output does not have enough
remaining mutable capacity.
Sourcefn decode_buf_to_mut<B, M>(
&self,
input: B,
output: &mut M,
) -> Result<usize, DecodeError>
fn decode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, DecodeError>
Decodes all remaining Base64 bytes from input into output.
§Errors
Returns DecodeError::OutputTooSmall if output does not have enough
remaining mutable capacity, or another DecodeError if decoding
fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".