pub fn parse_bounded<T: DeserializeOwned>(
bytes: &[u8],
limits: &ParseLimits,
) -> Result<T, ParseError>Expand description
Scan bytes, then deserialize them into T.
Allocation discipline: the scan allocates only its container stack (at
most max_depth frames) and one key set per open object (their total size
is bounded by the input length, itself bounded by max_bytes). Typed
deserialization runs only after the scan accepts, so its allocations are
bounded by the accepted input. Reading the bytes from any transport is the
caller’s job and must be bounded separately.
serde_json applies its own recursion limit of 128; a max_depth above
that can still yield a ParseError::Schema for deep input.