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.