qubit_codec/transcoder/transcode_status.rs
1/*******************************************************************************
2 *
3 * Copyright (c) 2026 Haixing Hu.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10/// Reports why a [`crate::Transcoder`] stopped converting input.
11#[derive(Clone, Copy, Debug, Eq, PartialEq)]
12pub enum TranscodeStatus {
13 /// All currently supplied input was consumed.
14 Complete,
15
16 /// More input is needed to complete the next output value.
17 ///
18 /// If the caller has reached EOF, it should call [`crate::Transcoder::finish`]
19 /// so the transcoder can finalize or reject the incomplete stream state.
20 ///
21 /// - `input_index`: Absolute input index where input ended while decoding.
22 /// - `required`: Number of additional input units required to continue.
23 /// - `available`: Number of input units currently available from the current
24 /// input position.
25 NeedInput {
26 /// Absolute input index where input ended.
27 input_index: usize,
28 /// Number of additional input units required to continue.
29 required: usize,
30 /// Number of input units currently available.
31 available: usize,
32 },
33
34 /// More output capacity is needed before conversion can continue.
35 ///
36 /// - `output_index`: Absolute output index where output ended while decoding.
37 /// - `required`: Number of additional output units required to continue.
38 /// - `available`: Number of output units currently available from the current
39 /// output position.
40 NeedOutput {
41 /// Absolute output index where output ended.
42 output_index: usize,
43 /// Number of additional output units required to continue.
44 required: usize,
45 /// Number of output units currently available.
46 available: usize,
47 },
48}