Skip to main content

charge_value_nodes

Function charge_value_nodes 

Source
fn charge_value_nodes(kind: &str, nodes: usize) -> Result<(), Error>
Expand description

Charges nodes against the per-datum DECODE_NODES budget shared by every array and map in a single top-level decode, rejecting once the cumulative total exceeds MAX_VALUE_NODES. kind ("array" / "map") only labels the error.

The budget is shared — rather than tracked per collection instance — so the cap composes across nesting; see MAX_VALUE_NODES for why a per-collection budget would let nested zero-width collections amplify past it.