pub struct SizeLimit { /* private fields */ }
Expand description
Represents size limit of the stream to prevent DoS attacks.
Please refer Constraints
for more info.
Implementations§
source§impl SizeLimit
impl SizeLimit
sourcepub fn new() -> SizeLimit
pub fn new() -> SizeLimit
Creates a default size limit which is u64::MAX
for the whole stream
and for each field.
sourcepub fn whole_stream(self, limit: u64) -> SizeLimit
pub fn whole_stream(self, limit: u64) -> SizeLimit
Sets size limit for the whole stream.
sourcepub fn for_field<N: Into<String>>(self, field_name: N, limit: u64) -> SizeLimit
pub fn for_field<N: Into<String>>(self, field_name: N, limit: u64) -> SizeLimit
Sets size limit for a specific field, it overrides the
per_field
value for this field.
It is useful when you want to set a size limit on a textual field which will be stored in memory to avoid potential DoS attacks from attackers running the server out of memory.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SizeLimit
impl Send for SizeLimit
impl Sync for SizeLimit
impl Unpin for SizeLimit
impl UnwindSafe for SizeLimit
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