Skip to main content

write_pending_async

Function write_pending_async 

Source
pub async fn write_pending_async<E, W>(enc: &mut E, w: &mut W) -> Result<usize>
where E: Encoder, W: AsyncWrite + Unpin + ?Sized,
Expand description

Write every byte enc has pending to w, then consume it: the async twin of write_pending. Returns how many bytes were written.

Encoding is CPU work, so where push_rows runs is the caller’s choice (a blocking thread, a compute pool); this only moves the bytes. Between pushes, awaiting it is the backpressure point: no more rows go in until the transport took the last batch. This also keeps the encoder’s raw and intermediate state alive during the wait. For an admitted buffered job, completing into separately budgeted encoded storage can release that state earlier. On an error nothing is consumed and the transport holds an unknown prefix: abort it.