Skip to main content

qubit_text_codec/codec/
decode_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/// Non-error status reported after inspecting a decoder input prefix.
11#[derive(Clone, Copy, Debug, Eq, PartialEq)]
12#[must_use]
13pub enum DecodeStatus {
14    /// A complete value was decoded from the prefix.
15    Complete {
16        /// The decoded Unicode scalar value.
17        value: char,
18
19        /// The number of input units consumed.
20        consumed: usize,
21    },
22
23    /// The current prefix is well-formed so far but incomplete.
24    NeedMore {
25        /// The total number of input units required.
26        required: usize,
27
28        /// The number of input units currently available.
29        available: usize,
30    },
31}