pub struct EncoderWriter<W, A, const PAD: bool>where
A: Alphabet,{ /* private fields */ }Expand description
Async writer that accepts raw bytes and writes Base64 to the wrapped writer.
poll_write may accept only part of the input, following normal
AsyncWrite rules. Accepted bytes may remain buffered internally until
a later write, AsyncWrite::poll_flush, or AsyncWrite::poll_shutdown.
Shutdown is the finalization boundary: it encodes any trailing partial
quantum, drains all buffered output, flushes, and then shuts down inner.
§Security
Internal cleanup is best-effort and limited to this adapter’s fixed pending and output buffers. It cannot clear copies held by the wrapped writer, the caller’s buffers, registers, caches, swap, or crash dumps.
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> EncoderWriter<W, A, PAD>where
A: Alphabet,
impl<W, A, const PAD: bool> EncoderWriter<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 encoder writer.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes the adapter and returns the wrapped writer.
This does not finalize pending input. Prefer
AsyncWriteExt::shutdown before
calling this when the Base64 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 pending_len(&self) -> usize
pub const fn pending_len(&self) -> usize
Returns the number of raw bytes buffered until a full encode quantum is available.
Sourcepub const fn buffered_output_len(&self) -> usize
pub const fn buffered_output_len(&self) -> usize
Returns the number of encoded bytes currently buffered for inner.
Trait Implementations§
Source§impl<W, A, const PAD: bool> AsyncWrite for EncoderWriter<W, A, PAD>
impl<W, A, const PAD: bool> AsyncWrite for EncoderWriter<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