Skip to main content

ClientPoolBuilder

Struct ClientPoolBuilder 

Source
pub struct ClientPoolBuilder { /* private fields */ }
Expand description

Builder for ClientPool.

Implementations§

Source§

impl ClientPoolBuilder

Source

pub fn new() -> Self

Create a builder with default settings: empty URL/base path, no default headers, one connection, TCP nodelay off, default buffer capacities.

Source

pub fn url(self, url: &str) -> Self

Target URL (scheme + host + optional port + optional path).

Source

pub fn base_path(self, path: &str) -> Self

Base path prefix for all requests.

Source

pub fn default_header(self, name: &str, value: &str) -> Result<Self, RestError>

Add a default header sent with every request.

Source

pub fn connections(self, n: usize) -> Self

Number of pre-allocated connections. Default: 1.

Source

pub fn tls(self, config: &TlsConfig) -> Self

Custom TLS configuration.

Source

pub fn disable_nagle(self) -> Self

Disable Nagle’s algorithm on each connection.

Source

pub fn tcp_keepalive(self, idle: Duration) -> Self

Set TCP keepalive idle time on each connection.

Source

pub fn recv_buffer_size(self, n: usize) -> Self

Set SO_RCVBUF on each connection.

Source

pub fn send_buffer_size(self, n: usize) -> Self

Set SO_SNDBUF on each connection.

Source

pub fn write_buffer_capacity(self, n: usize) -> Self

Write buffer capacity per slot. Default: 32KB.

Source

pub fn response_buffer_capacity(self, n: usize) -> Self

Response buffer capacity per slot. Default: 32KB.

Source

pub fn max_body_size(self, n: usize) -> Self

Maximum response body size per slot. Default: 0 (no limit).

Source

pub async fn build(self) -> Result<ClientPool, RestError>

Build the pool, establishing all connections.

Trait Implementations§

Source§

impl Default for ClientPoolBuilder

Source§

fn default() -> Self

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

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V