pub struct DecoderReader<R, A, const PAD: bool>where
A: Alphabet,{ /* private fields */ }Expand description
A streaming Base64 decoder for std::io::Read.
For padded engines, this reader stops at the terminal padded Base64 block and leaves later bytes unread in the wrapped reader. This preserves boundaries for callers that decode one Base64 payload from a larger stream.
Implementations§
Source§impl<R, A, const PAD: bool> DecoderReader<R, A, PAD>where
A: Alphabet,
impl<R, A, const PAD: bool> DecoderReader<R, A, PAD>where
A: Alphabet,
Sourcepub const fn pending_len(&self) -> usize
pub const fn pending_len(&self) -> usize
Returns the number of encoded input bytes currently buffered until a complete 4-byte Base64 decode quantum is available.
Sourcepub const fn has_pending_input(&self) -> bool
pub const fn has_pending_input(&self) -> bool
Returns whether this decoder reader currently holds a partial input quantum.
Sourcepub const fn pending_input_needed_len(&self) -> usize
pub const fn pending_input_needed_len(&self) -> usize
Returns how many additional encoded input bytes are needed to complete the currently buffered decode quantum.
Returns 0 when no partial input quantum is buffered.
Sourcepub const fn buffered_output_len(&self) -> usize
pub const fn buffered_output_len(&self) -> usize
Returns the number of decoded bytes currently buffered and ready to be read before this adapter polls the wrapped reader again.
Sourcepub const fn buffered_output_capacity(&self) -> usize
pub const fn buffered_output_capacity(&self) -> usize
Returns the maximum number of decoded bytes this adapter can buffer before returning bytes to the caller.
Sourcepub const fn buffered_output_remaining_capacity(&self) -> usize
pub const fn buffered_output_remaining_capacity(&self) -> usize
Returns how many more decoded bytes can be buffered before this adapter must return bytes to the caller.
Sourcepub const fn has_buffered_output(&self) -> bool
pub const fn has_buffered_output(&self) -> bool
Returns whether this decoder reader currently has decoded output waiting in its internal queue.
Sourcepub const fn has_terminal_padding(&self) -> bool
pub const fn has_terminal_padding(&self) -> bool
Returns whether this decoder reader has seen terminal padding.
For padded engines, this becomes true after the terminal padded
block is decoded. The wrapped reader is then left positioned after
that Base64 block so adjacent framed bytes can be read by the
caller.
Sourcepub const fn has_finished_input(&self) -> bool
pub const fn has_finished_input(&self) -> bool
Returns whether this decoder reader has reached EOF or terminal padding in the wrapped reader.
This may become true before Self::is_finished when decoded
output is still buffered for the caller.
Sourcepub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Returns whether this reader has reached EOF or terminal padding and has no decoded output buffered for the caller.
Sourcepub const fn is_failed(&self) -> bool
pub const fn is_failed(&self) -> bool
Returns whether this decoder reader has rejected malformed Base64 input.
Once this returns true, later reads return an error. The unchecked
Self::into_inner method can still be used for explicit recovery
of the wrapped reader.
Sourcepub const fn can_into_inner(&self) -> bool
pub const fn can_into_inner(&self) -> bool
Returns whether Self::try_into_inner can recover the wrapped
reader without discarding buffered decoded output.
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Consumes the decoder reader and returns the wrapped reader.
Sourcepub fn try_into_inner(self) -> Result<R, Self>
pub fn try_into_inner(self) -> Result<R, Self>
Consumes the decoder reader only after the Base64 payload is fully drained.
For padded streams, terminal padding may leave adjacent framed bytes unread in the wrapped reader. This method succeeds only after all decoded output buffered by this adapter has been read, so recovering the wrapped reader does not silently discard decoded bytes.
Trait Implementations§
Source§impl<R, A, const PAD: bool> Read for DecoderReader<R, A, PAD>
impl<R, A, const PAD: bool> Read for DecoderReader<R, A, PAD>
Source§fn read(&mut self, output: &mut [u8]) -> Result<usize>
fn read(&mut self, output: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more