qubit-json 0.12.4

Resource-aware infrastructure for lenient and strict JSON processing
Documentation
// =============================================================================
//    Copyright (c) 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Structured reasons for failures while materializing unique-key JSON.

/// Describes why an admitted unique-key document could not be materialized.
///
/// The reason is available independently of diagnostic source retention and
/// never contains input-derived text.
///
/// # Examples
///
/// ```
/// use qubit_json::decode::JsonMaterializationErrorReason;
///
/// let reason = JsonMaterializationErrorReason::DuplicateKey;
/// assert_eq!(reason, JsonMaterializationErrorReason::DuplicateKey);
/// ```
#[non_exhaustive]
#[must_use]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum JsonMaterializationErrorReason {
    /// A decoded object key appeared more than once.
    DuplicateKey,
    /// Historical compatibility reason; the shared builder no longer produces
    /// it.
    DepthLimit {
        /// Maximum number of nested containers accepted during construction.
        limit: usize,
    },
    /// An admitted number could not be represented by the intermediate tree.
    InvalidNumber,
}