qubit-json 0.12.2

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.
// =============================================================================
//! Defines the no-op visitor used for accounting-only traversal.

use std::convert::Infallible;

use serde_json::Value;

use super::super::JsonTreeContext;
use super::super::JsonTreeVisitor;

/// Accepts every admitted node without adding domain behavior.
pub(in crate::value::traverse) struct NoopVisitor;

impl JsonTreeVisitor for NoopVisitor {
    /// Error type proving this visitor has no failing operation.
    type Error = Infallible;

    /// Accepts an entered node.
    ///
    /// # Parameters
    ///
    /// * `_value` - The admitted JSON node; it is ignored by this visitor.
    /// * `_context` - The node's traversal location and depth; it is ignored.
    #[inline(always)]
    fn enter(&mut self, _value: &Value, _context: JsonTreeContext<'_>) -> Result<(), Self::Error> {
        Ok(())
    }
}