qubit_json/decode/json_materialization_error_reason.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Structured reasons for failures while materializing unique-key JSON.
9
10/// Describes why an admitted unique-key document could not be materialized.
11///
12/// The reason is available independently of diagnostic source retention and
13/// never contains input-derived text.
14#[non_exhaustive]
15#[must_use]
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17pub enum JsonMaterializationErrorReason {
18 /// A decoded object key appeared more than once.
19 DuplicateKey,
20 /// Historical compatibility reason; the shared builder no longer produces
21 /// it.
22 DepthLimit {
23 /// Maximum number of nested containers accepted during construction.
24 limit: usize,
25 },
26 /// An admitted number could not be represented by the intermediate tree.
27 InvalidNumber,
28}