Skip to main content

MAX_NESTING_DEPTH

Constant MAX_NESTING_DEPTH 

Source
pub const MAX_NESTING_DEPTH: usize = 128;
Expand description

The maximum number of nested objects and arrays a Variant may contain.

Full validation recurses into nested values, so unbounded nesting would overflow the stack – an abort, not a catchable panic. Validation therefore rejects more deeply nested values, which also bounds the recursion of infallible accesses such as Debug and PartialEq.

The variant spec does not specify a limit. This value matches the default serde_json recursion limit, so any variant parsed from JSON already satisfies it.