1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Defines context supplied with one JSON tree callback.
use JsonTreeLocation;
/// Describes the root-inclusive depth and parent location of a JSON node.
///
/// # Type Parameters
///
/// * `'a` - Lifetime of an object key borrowed from the traversed JSON tree.
///
/// # Examples
///
/// ```
/// use qubit_json::value::traverse::JsonTreeContext;
/// use qubit_json::value::traverse::JsonTreeLocation;
///
/// let key = "items";
/// let context = JsonTreeContext {
/// depth: 2,
/// location: JsonTreeLocation::ObjectValue { key },
/// };
/// assert_eq!(context.depth, 2);
/// assert_eq!(context.location, JsonTreeLocation::ObjectValue { key });
/// ```