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 decoder consumed input or initialized output without another await.
30 Progress(
31 /// Consumed and written counts and the decoder stop status.
32 TranscodeProgress,
33 ),
34}