Skip to main content

qubit_budget/structure/
structure_resource.rs

1// =============================================================================
2//    Copyright (c) 2025 - 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Defines resource identities for structural input limits.
9
10/// A structural quantity constrained while processing nested data.
11///
12/// # Examples
13///
14/// ```
15/// use qubit_budget::ResourceLimit;
16/// use qubit_budget::StructureResource;
17///
18/// let limit = ResourceLimit::new(StructureResource::Depth, 4_usize);
19/// assert_eq!(limit.maximum(), 4);
20/// ```
21#[non_exhaustive]
22#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
23pub enum StructureResource {
24    /// The nesting depth of the current value.
25    Depth,
26
27    /// The cumulative number of nodes processed in one session.
28    Nodes,
29
30    /// The number of items in one sequence value.
31    SequenceItems,
32
33    /// The number of entries in one map value.
34    MapEntries,
35
36    /// The byte length of one structural key.
37    KeyBytes,
38}