pub struct LimitsBuilder { /* private fields */ }Expand description
Builds Limits; every setter is optional.
use net_io::{ConfigReason, Limits, NetError};
let err = Limits::builder().max_connections(100).max_per_listener(200).build().unwrap_err();
assert!(matches!(err, NetError::InvalidConfig { field: "max_per_listener", reason: ConfigReason::AboveGlobal }));
assert!(Limits::builder().max_connections(100).build().is_ok());Implementations§
Source§impl LimitsBuilder
impl LimitsBuilder
Sourcepub fn max_connections(self, value: u32) -> Self
pub fn max_connections(self, value: u32) -> Self
The global connection cap.
Sourcepub fn max_per_listener(self, value: u32) -> Self
pub fn max_per_listener(self, value: u32) -> Self
The per-listener connection cap.
Sourcepub fn accept_batch(self, value: u16) -> Self
pub fn accept_batch(self, value: u16) -> Self
Connections accepted per wake-up.
Sourcepub fn handshake_timeout(self, value: Duration) -> Self
pub fn handshake_timeout(self, value: Duration) -> Self
Time for the PROXY header and TLS handshake together.
Sourcepub fn idle_timeout(self, value: Duration) -> Self
pub fn idle_timeout(self, value: Duration) -> Self
Time to wait for the next exchange.
Sourcepub fn read_timeout(self, value: Duration) -> Self
pub fn read_timeout(self, value: Duration) -> Self
Time to wait for bytes during an exchange.
Sourcepub fn write_timeout(self, value: Duration) -> Self
pub fn write_timeout(self, value: Duration) -> Self
Time to wait for the peer to take bytes.
Sourcepub fn park_timeout(self, value: Duration) -> Self
pub fn park_timeout(self, value: Duration) -> Self
Time a parked connection may wait for its completion.
Sourcepub fn min_rate(self, value: MinRate) -> Self
pub fn min_rate(self, value: MinRate) -> Self
The minimum transfer rate (MinRate::off to disable).
Sourcepub fn output_budget(self, value: u32) -> Self
pub fn output_budget(self, value: u32) -> Self
Pool memory a connection’s output may hold.
Sourcepub fn buffer_budget(self, value: u64) -> Self
pub fn buffer_budget(self, value: u64) -> Self
Total bytes of buffers all workers may allocate.
Sourcepub fn drain_timeout(self, value: Duration) -> Self
pub fn drain_timeout(self, value: Duration) -> Self
The drain deadline.
Sourcepub fn refusal_bytes_max(self, value: u16) -> Self
pub fn refusal_bytes_max(self, value: u16) -> Self
The largest refusal reply (at most 512).
Sourcepub fn pressure(self, value: Pressure) -> Self
pub fn pressure(self, value: Pressure) -> Self
Adaptive deadlines under pressure (applied from 0.6.0).
Sourcepub fn max_per_source(self, n: u32, policy: PrefixPolicy) -> Self
pub fn max_per_source(self, n: u32, policy: PrefixPolicy) -> Self
The per-source concurrency cap and how sources are grouped.
Sourcepub fn proxy_header_max(self, v2_body_bytes: u16) -> Self
pub fn proxy_header_max(self, v2_body_bytes: u16) -> Self
The PROXY v2 address-and-TLV cap (up to 65,519).
Sourcepub fn read_class(self, initial: SizeClass, max: SizeClass) -> Self
pub fn read_class(self, initial: SizeClass, max: SizeClass) -> Self
The initial read buffer class and the largest a session may grow it to.
Sourcepub fn completion_queue(self, n: u32) -> Self
pub fn completion_queue(self, n: u32) -> Self
A worker’s completion queue length, rounded up to a power of two.
Sourcepub fn graceful_linger(self, time: Duration, bytes: u32) -> Self
pub fn graceful_linger(self, time: Duration, bytes: u32) -> Self
The graceful-close linger: time and bytes read and discarded.
Sourcepub fn lane_reserve(self, lane: Lane, slots: u32) -> Self
pub fn lane_reserve(self, lane: Lane, slots: u32) -> Self
Connection slots reserved for lane (lanes 0 to 7; applied from 0.6.0).