qubit_io/coder/coder_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::Coder`] stopped converting input.
11#[derive(Clone, Copy, Debug, Eq, PartialEq)]
12pub enum CoderStatus {
13 /// All currently supplied input was consumed.
14 Complete,
15
16 /// More input is needed to complete the next output value.
17 ///
18 /// - `input_index`: Absolute input index where input ended while decoding.
19 /// - `required`: Number of additional input units required to continue.
20 /// - `available`: Number of input units currently available from the current
21 /// input position.
22 NeedInput {
23 /// Absolute input index where input ended.
24 input_index: usize,
25 /// Number of additional input units required to continue.
26 required: usize,
27 /// Number of input units currently available.
28 available: usize,
29 },
30
31 /// More output capacity is needed before conversion can continue.
32 ///
33 /// - `output_index`: Absolute output index where output ended while decoding.
34 /// - `required`: Number of additional output units required to continue.
35 /// - `available`: Number of output units currently available from the current
36 /// output position.
37 NeedOutput {
38 /// Absolute output index where output ended.
39 output_index: usize,
40 /// Number of additional output units required to continue.
41 required: usize,
42 /// Number of output units currently available.
43 available: usize,
44 },
45}