pub struct Limits {
pub max_depth: u32,
pub max_elements: u64,
pub max_element_length: u64,
pub max_work: u64,
}Expand description
How much a parse may spend.
The defaults are generous, because they exist to stop a document that is trying to make this run forever, not to decide that real documents are too big. A caller on a device with less to spend lowers them.
Fields§
§max_depth: u32How deeply elements may nest.
Certificates and signed data nest perhaps a dozen deep. A thousand is a document doing something else.
max_elements: u64How many elements may be read in total.
max_element_length: u64How long a single element’s contents may be.
max_work: u64How many bytes of header and structure may be examined.
Content bytes are not counted against this: reading a large certificate is not the thing worth stopping. What this bounds is the number of elements-worth of parsing a document can ask for, which is what a deeply or densely nested input inflates.
Implementations§
Trait Implementations§
impl Copy for Limits
impl Eq for Limits
impl StructuralPartialEq for Limits
Auto Trait Implementations§
impl Freeze for Limits
impl RefUnwindSafe for Limits
impl Send for Limits
impl Sync for Limits
impl Unpin for Limits
impl UnsafeUnpin for Limits
impl UnwindSafe for Limits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more