qubit_codec/transcode/io/async_transcode_decode_step.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Result type for one asynchronous decode operation.
9
10use crate::TranscodeProgress;
11
12/// Result of one cancellation-safe asynchronous decode operation.
13///
14/// # Examples
15///
16/// ```
17/// use qubit_codec::AsyncTranscodeDecodeStep;
18///
19/// let step = AsyncTranscodeDecodeStep::EndOfInput;
20/// assert!(matches!(step, AsyncTranscodeDecodeStep::EndOfInput));
21/// ```
22#[derive(Clone, Copy, Debug, Eq, PartialEq)]
23#[must_use]
24pub enum AsyncTranscodeDecodeStep {
25 /// The wrapped input reached EOF with no unread units. Call
26 /// [`crate::AsyncTranscodeDecodeInput::transcode_eof_step`] to dispatch
27 /// that EOF event to the decoder.
28 EndOfInput,
29 /// The result of one decode step, returned without another await.
30 /// Both `read()` and `written()` may be zero. Inspect the stop status to
31 /// decide whether to refill input, provide output capacity, or handle EOF.
32 Progress(
33 /// Consumed and written counts and the decoder stop status.
34 TranscodeProgress,
35 ),
36}