Skip to main content

transcode_async

Function transcode_async 

Source
pub fn transcode_async<'a, D, E, Src, W, C>(
    decoder: D,
    encoder: E,
    source: &'a mut Src,
    out: &'a mut W,
    compute: C,
    opts: DriveOptions,
    pulse: Option<SharedPulse>,
) -> impl Future<Output = Result<u64, AsyncDriveError<D::Error>>> + Send + 'a
where D: IncrementalDecode + Send + 'static, E: Encoder + Send + 'static, E::Error: Send + Sync, Src: AsyncSource + ?Sized, W: AsyncWrite + Unpin + Send + ?Sized, C: Compute + 'a,
Expand description

Decode from an async source straight into a streaming encoder, writing encoded bytes to out after every batch. This does not establish an end-to-end memory bound: codec-owned raw/intermediate state and caller-owned input can remain live while the output is stalled. The current driver also drains pending output before finalizing the encoder. Select an operation strategy based on the actual configuration’s retention and release behavior.

The encoder is told the image size through Encoder::begin when the decoder reaches its header; an encoder that answers with a streaming OutputTiming then emits bytes as rows arrive, and one that answers AT_FINISH writes everything at the end. Returns the number of bytes written.