pub struct ResourceLimits {
pub max_response_size: u64,
pub max_parse_time_ms: u64,
pub max_decompressed_size: u64,
pub max_compression_ratio: f64,
pub max_dom_depth: usize,
pub max_dom_elements: usize,
}Expand description
Resource limits
Fields§
§max_response_size: u64Max response size (bytes)
max_parse_time_ms: u64Max parsing time (ms)
max_decompressed_size: u64Max decompressed size (bytes)
max_compression_ratio: f64Max compression ratio (anti zip-bomb)
max_dom_depth: usizeMax DOM depth
max_dom_elements: usizeMax DOM elements
Implementations§
Source§impl ResourceLimits
impl ResourceLimits
Sourcepub fn check_response_size(&self, size: u64) -> Result<()>
pub fn check_response_size(&self, size: u64) -> Result<()>
Check response size (returns main Error type)
Sourcepub fn check_response_size_limit(&self, size: u64) -> Result<(), LimitError>
pub fn check_response_size_limit(&self, size: u64) -> Result<(), LimitError>
Check response size (returns LimitError)
Sourcepub fn check_decompressed_size(&self, size: u64) -> Result<(), LimitError>
pub fn check_decompressed_size(&self, size: u64) -> Result<(), LimitError>
Check decompressed size
Sourcepub fn check_compression_ratio(
&self,
compressed: u64,
decompressed: u64,
) -> Result<(), LimitError>
pub fn check_compression_ratio( &self, compressed: u64, decompressed: u64, ) -> Result<(), LimitError>
Check compression ratio
Sourcepub fn check_parse_time(&self, elapsed_ms: u64) -> Result<()>
pub fn check_parse_time(&self, elapsed_ms: u64) -> Result<()>
Check parsing time
Sourcepub fn check_dom_depth(&self, depth: usize) -> Result<(), LimitError>
pub fn check_dom_depth(&self, depth: usize) -> Result<(), LimitError>
Check DOM depth
Sourcepub fn check_dom_elements(&self, count: usize) -> Result<(), LimitError>
pub fn check_dom_elements(&self, count: usize) -> Result<(), LimitError>
Check DOM element count
Trait Implementations§
Source§impl Clone for ResourceLimits
impl Clone for ResourceLimits
Source§fn clone(&self) -> ResourceLimits
fn clone(&self) -> ResourceLimits
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResourceLimits
impl Debug for ResourceLimits
Auto Trait Implementations§
impl Freeze for ResourceLimits
impl RefUnwindSafe for ResourceLimits
impl Send for ResourceLimits
impl Sync for ResourceLimits
impl Unpin for ResourceLimits
impl UnwindSafe for ResourceLimits
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