qubit-json 0.12.2

Resource-aware infrastructure for lenient and strict JSON processing
Documentation
// =============================================================================
//    Copyright (c) 2025 - 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Errors reported while rendering a JSON value as JCS.

use serde_json::Error;

use crate::encode::JcsWorkingMemoryError;
use crate::encode::JsonSerializationError;

/// Describes failures encountered while rendering a JSON value as JCS.
#[must_use]
#[derive(Debug)]
pub(in crate::encode) enum JcsRendererError {
    /// The renderer exceeded its configured working-memory budget.
    WorkingMemory(
        /// Configured and requested auxiliary-memory byte counts.
        JcsWorkingMemoryError,
    ),
    /// Canonical JSON serialization or output writing failed.
    Serialize(
        /// The underlying serialization or writer failure.
        Error,
    ),
    /// A privacy-safe number classification retained from the current value.
    Number(
        /// Stable classification that does not retain the number's text.
        JsonSerializationError,
    ),
    /// An auxiliary allocation could not be completed.
    Allocation,
}