qubit-codec 0.17.4

Core codec traits and buffer conversion primitives 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;

/// Error reported by output-capacity planning APIs.
///
/// Capacity planning is separate from actual transcoding. This error means the
/// requested upper bound cannot be represented as a `usize`; callers should
/// reject the one-shot allocation request or switch to chunked streaming.
///
/// # Examples
///
/// ```
/// use qubit_codec::CapacityError;
///
/// let error = CapacityError::OutputLengthOverflow;
/// assert_eq!(error.to_string(), "output length overflow");
/// ```
#[derive(Clone, Copy, Debug, Eq, Error, Hash, PartialEq)]
#[non_exhaustive]
#[must_use]
pub enum CapacityError {
    /// The computed output length overflowed `usize`.
    #[error("output length overflow")]
    OutputLengthOverflow,
}