Trait LengthLimitExt

Source
pub trait LengthLimitExt: Sized + AsyncRead {
    // Provided methods
    fn limit_bytes(self, max_bytes: usize) -> LengthLimit<Self> { ... }
    fn limit_kb(self, max_kb: usize) -> LengthLimit<Self> { ... }
    fn limit_mb(self, max_mb: usize) -> LengthLimit<Self> { ... }
    fn limit_gb(self, max_gb: usize) -> LengthLimit<Self> { ... }
}
Expand description

Extension trait to add length limiting behavior to any AsyncRead

Full explanation of the behavior at LengthLimit

Provided Methods§

Source

fn limit_bytes(self, max_bytes: usize) -> LengthLimit<Self>

Applies a LengthLimit to self with an exclusive maxiumum of max_bytes bytes

Source

fn limit_kb(self, max_kb: usize) -> LengthLimit<Self>

Applies a LengthLimit to self with an exclusive maxiumum of max_kb kilobytes (defined as 1024 bytes)

Source

fn limit_mb(self, max_mb: usize) -> LengthLimit<Self>

Applies a LengthLimit to self with an exclusive maxiumum of max_mb megabytes (defined as 1024 kilobytes, or 1,048,576 bytes)

Source

fn limit_gb(self, max_gb: usize) -> LengthLimit<Self>

Applies a LengthLimit to self with an exclusive maxiumum of max_gb kilobytes (defined as 1024 megabytes, or 1,073,741,824 bytes)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> LengthLimitExt for T
where T: AsyncRead + Unpin,