Skip to main content

EngineBytesExt

Trait EngineBytesExt 

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

Source

fn encode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, EncodeError>

Encodes bytes into a Bytes value.

§Errors

Returns EncodeError if the encoded length overflows.

Source

fn decode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, DecodeError>

Decodes Base64 bytes into a Bytes value.

§Errors

Returns DecodeError if decoding fails.

Source

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.

Source

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.

Source

fn encode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, EncodeError>
where B: Buf, M: BufMut,

Encodes all remaining bytes from input into output.

§Errors

Returns EncodeError::OutputTooSmall if output does not have enough remaining mutable capacity.

Source

fn decode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, DecodeError>
where B: Buf, M: BufMut,

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".

Implementations on Foreign Types§

Source§

impl<A, const PAD: bool> EngineBytesExt<A, PAD> for Engine<A, PAD>
where A: Alphabet,

Source§

fn encode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, EncodeError>

Source§

fn decode_bytes(&self, input: impl AsRef<[u8]>) -> Result<Bytes, DecodeError>

Source§

fn encode_buf<B>(&self, input: B) -> Result<Bytes, EncodeError>
where B: Buf,

Source§

fn decode_buf<B>(&self, input: B) -> Result<Bytes, DecodeError>
where B: Buf,

Source§

fn encode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, EncodeError>
where B: Buf, M: BufMut,

Source§

fn decode_buf_to_mut<B, M>( &self, input: B, output: &mut M, ) -> Result<usize, DecodeError>
where B: Buf, M: BufMut,

Implementors§