Skip to main content

PoolConfig

Struct PoolConfig 

Source
pub struct PoolConfig {
    pub max_idle_connections: Option<usize>,
    pub max_idle_connections_per_host: Option<usize>,
    pub max_connections: Option<usize>,
    pub max_connections_per_host: Option<usize>,
    pub max_in_flight_requests: Option<usize>,
    pub max_in_flight_requests_per_origin: Option<usize>,
    pub idle_timeout: Option<Duration>,
}
Expand description

Configuration for the connection pool.

All fields are optional. When a field is None, the corresponding limit is not applied.

§Logical vs physical limits

max_in_flight_requests / max_in_flight_requests_per_origin (and their compatibility aliases max_connections / max_connections_per_host) bound logical in-flight requests (pool permits, one per request). They do not bound physical TCP connections: under HTTP/2 one connection carries many multiplexed streams, under HTTP/3 one QUIC connection carries many streams, and Hyper owns socket reuse opaquely. Idle-connection caps (max_idle_connections*, idle_timeout) are physical idle-pool policy passed to Hyper and are distinct from semaphore concurrency.

Fields§

§max_idle_connections: Option<usize>

Maximum number of idle (unused) connections kept per host.

Applied as a per-host cap (the transport has no global idle limit); see Self::max_connections for a global bound. This is physical idle-pool policy, not logical concurrency.

§max_idle_connections_per_host: Option<usize>

Maximum number of idle connections per individual host.

Physical idle-pool policy.

§max_connections: Option<usize>

Maximum total number of concurrent in-flight requests (logical).

Compatibility alias for Self::max_in_flight_requests kept for the pre-1.0 release line. Prefer max_in_flight_requests in new code; when both are set, max_in_flight_requests wins.

§max_connections_per_host: Option<usize>

Maximum number of concurrent in-flight requests per origin (logical).

Compatibility alias for Self::max_in_flight_requests_per_origin. Origins are keyed by (scheme, host, port). Prefer the new name; when both are set, max_in_flight_requests_per_origin wins.

§max_in_flight_requests: Option<usize>

Maximum total number of concurrent in-flight requests (logical).

Preferred native name; one permit equals one logical request, not one TCP connection. See the type-level docs for H1/H2/H3 examples.

§max_in_flight_requests_per_origin: Option<usize>

Maximum number of concurrent in-flight requests per origin (logical).

Preferred native name. Origins are keyed by (scheme, host, port).

§idle_timeout: Option<Duration>

Duration after which an idle connection is closed.

Physical idle lifetime, not a concurrency bound. When set, every persistent Hyper client also receives the pool timer Hyper requires for background idle eviction; Timeout.pool/total are never reused for this. See HyperClientPolicy and Pool::max_idle_per_host.

Trait Implementations§

Source§

impl Clone for PoolConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PoolConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PoolConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Limits> for PoolConfig

Source§

fn from(limits: Limits) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more