pub struct DecoderWriter<W, A, const PAD: bool>where
A: Alphabet,{ /* private fields */ }Expand description
Async writer that accepts Base64 bytes and writes decoded bytes to inner.
The adapter validates strict Base64 quanta as input is accepted. Shutdown is the finalization boundary and validates any final unpadded tail.
§Security
Streaming decode is not atomic. Decoded bytes from valid leading quanta may
already have been written before a later malformed quantum is observed. For
atomic or secret-bearing frames, collect a bounded frame and use a
non-streaming strict or ct decode path.
I/O errors from the wrapped writer during drain do not set Self::is_failed;
only internal protocol or capacity violations latch a permanent failure.
Implementations§
Source§impl<W, A, const PAD: bool> DecoderWriter<W, A, PAD>where
A: Alphabet,
impl<W, A, const PAD: bool> DecoderWriter<W, A, PAD>where
A: Alphabet,
Sourcepub fn new(inner: W, engine: Engine<A, PAD>) -> Self
pub fn new(inner: W, engine: Engine<A, PAD>) -> Self
Creates a new async Base64 decoder writer.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes the adapter and returns the wrapped writer.
This does not validate final pending input. Prefer
AsyncWriteExt::shutdown before
calling this when the decoded stream must be complete.
Sourcepub const fn is_failed(&self) -> bool
pub const fn is_failed(&self) -> bool
Returns whether this adapter has encountered an unrecoverable error.
Sourcepub const fn is_finalized(&self) -> bool
pub const fn is_finalized(&self) -> bool
Returns whether shutdown has finalized this adapter.
Sourcepub const fn has_terminal_padding(&self) -> bool
pub const fn has_terminal_padding(&self) -> bool
Returns whether a terminal padded quantum has been accepted.
Sourcepub const fn pending_len(&self) -> usize
pub const fn pending_len(&self) -> usize
Returns the number of encoded bytes buffered until a full decode quantum is available.
Sourcepub const fn buffered_output_len(&self) -> usize
pub const fn buffered_output_len(&self) -> usize
Returns the number of decoded bytes currently buffered for inner.
Trait Implementations§
Source§impl<W, A, const PAD: bool> AsyncWrite for DecoderWriter<W, A, PAD>
impl<W, A, const PAD: bool> AsyncWrite for DecoderWriter<W, A, PAD>
Source§fn poll_write(
self: Pin<&mut Self>,
context: &mut Context<'_>,
input: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, context: &mut Context<'_>, input: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(
self: Pin<&mut Self>,
context: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_flush( self: Pin<&mut Self>, context: &mut Context<'_>, ) -> Poll<Result<()>>
Source§fn poll_shutdown(
self: Pin<&mut Self>,
context: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_shutdown( self: Pin<&mut Self>, context: &mut Context<'_>, ) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more