Skip to main content

qubit_io/codec/
leb128_decode_error_kind.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 ******************************************************************************/
10use thiserror::Error;
11
12/// Classifies failures detected while decoding LEB128 integers.
13#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
14pub enum Leb128DecodeErrorKind {
15    /// The input bytes cannot represent a value of the requested width.
16    #[error("malformed LEB128 integer")]
17    Malformed,
18
19    /// Strict decoding rejected a value that was not minimally encoded.
20    #[error("non-canonical LEB128 integer")]
21    NonCanonical,
22}