qubit-codec-binary 0.8.1

Buffer-oriented binary codecs for Rust
Documentation
// =============================================================================
//    Copyright (c) 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================
use thiserror::Error;

/// Classifies failures detected while decoding LEB128 integers.
///
/// # Examples
///
/// ```
/// use qubit_codec_binary::Leb128DecodeErrorKind;
///
/// let kind = Leb128DecodeErrorKind::NonCanonical;
/// assert_eq!(kind.to_string(), "non-canonical LEB128 integer");
/// ```
#[must_use]
#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
pub enum Leb128DecodeErrorKind {
    /// The input ended before a terminating LEB128 byte was available.
    #[error("incomplete LEB128 integer")]
    Incomplete,

    /// The input bytes cannot represent a value of the requested width.
    #[error("malformed LEB128 integer")]
    Malformed,

    /// Strict decoding rejected a value that was not minimally encoded.
    #[error("non-canonical LEB128 integer")]
    NonCanonical,
}