pub fn decode(
input: &[u8],
format: ResponseFormat,
limits: ResponseLimits,
) -> Result<Vec<u8>, ResponseError>Expand description
Decode one complete response without dispatching a command or retrying it.
Input size is checked before parsing. serde_json owns JSON grammar and
escaped strings; unknown metadata is skipped without building a value tree.
JSON parser storage is bounded by the input allowance; its allocations are
owned by Serde. Decoded bytes are reserved fallibly only after validating all
hex and its independent allowance. Text hex permits only Rust ASCII whitespace;
JSON hex is compact, even at its edges. Candid validity is not checked.
ยงErrors
Returns typed size, JSON, envelope, hex or allocation failures. The caller retains the original input for any explicitly authorized diagnostics.