JsonLimits structv0.1.0
What a caller will accept from a document.
pub struct JsonLimits {
pub maximumBytes: uint;
pub maximumTextBytes: uint;
pub maximumDepth: uint;
pub maximumEntries: uint;
}
Every field is a refusal a caller might need to make against untrusted input, and every default is generous enough for ordinary documents and far short of what exhausts a machine.
Fields
| Name | Type | Description |
|---|---|---|
maximumBytes | uint | The longest document, in bytes. |
maximumTextBytes | uint | The longest single string, in bytes. |
maximumDepth | uint | How deeply containers may nest. This is the one that protects a recursive parser's stack. |
maximumEntries | uint | How many elements or members one container may hold. |
Associated functions
Default
pub func Default() -> JsonLimits
Limits generous enough for ordinary documents: sixty-four mebibytes, sixteen mebibyte strings, a hundred and twenty-eight levels of nesting, and a million entries per container.
Returns: the limits an ordinary parse uses
Unlimited
pub func Unlimited() -> JsonLimits
No limits at all, for input that is already trusted. Named so that choosing it is visible: a document read from the network should never use this, and a reviewer should be able to find every place that did.
Returns: limits that refuse nothing, for input that is already trusted