pub struct Limits {
pub input_file_size: usize,
pub decompressed_json_size: usize,
}
Expand description
Protects against denial-of-service attacks via infinite input streams or zip bombs, which would otherwise use up all your memory and crash your machine.
If the limit is exceeded, an error is returned and no further deserialization is attempted.
The default limits are 1 GiB for the input_file_size
and 8 MiB for decompressed_json_size
.
Note that the decompressed_json_size
is only enforced on the level of the serialized JSON, i.e. a string.
We do not enforce that serde_json
does not consume more memory when deserializing JSON to Rust data structures.
Unfortunately Rust does not provide APIs for that.
Fields§
§input_file_size: usize
§decompressed_json_size: usize
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)