pub struct ClientPoolBuilder { /* private fields */ }Expand description
Builder for ClientPool.
Implementations§
Source§impl ClientPoolBuilder
impl ClientPoolBuilder
Sourcepub fn new() -> Self
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.
Sourcepub fn url(self, url: &str) -> Self
pub fn url(self, url: &str) -> Self
Target URL (scheme + host + optional port + optional path).
Sourcepub fn default_header(self, name: &str, value: &str) -> Result<Self, RestError>
pub fn default_header(self, name: &str, value: &str) -> Result<Self, RestError>
Add a default header sent with every request.
Sourcepub fn connections(self, n: usize) -> Self
pub fn connections(self, n: usize) -> Self
Number of pre-allocated connections. Default: 1.
Sourcepub fn disable_nagle(self) -> Self
pub fn disable_nagle(self) -> Self
Disable Nagle’s algorithm on each connection.
Sourcepub fn tcp_keepalive(self, idle: Duration) -> Self
pub fn tcp_keepalive(self, idle: Duration) -> Self
Set TCP keepalive idle time on each connection.
Sourcepub fn recv_buffer_size(self, n: usize) -> Self
pub fn recv_buffer_size(self, n: usize) -> Self
Set SO_RCVBUF on each connection.
Sourcepub fn send_buffer_size(self, n: usize) -> Self
pub fn send_buffer_size(self, n: usize) -> Self
Set SO_SNDBUF on each connection.
Sourcepub fn write_buffer_capacity(self, n: usize) -> Self
pub fn write_buffer_capacity(self, n: usize) -> Self
Write buffer capacity per slot. Default: 32KB.
Sourcepub fn response_buffer_capacity(self, n: usize) -> Self
pub fn response_buffer_capacity(self, n: usize) -> Self
Response buffer capacity per slot. Default: 32KB.
Sourcepub fn max_body_size(self, n: usize) -> Self
pub fn max_body_size(self, n: usize) -> Self
Maximum response body size per slot. Default: 0 (no limit).
Sourcepub async fn build(self) -> Result<ClientPool, RestError>
pub async fn build(self) -> Result<ClientPool, RestError>
Build the pool, establishing all connections.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientPoolBuilder
impl !RefUnwindSafe for ClientPoolBuilder
impl Send for ClientPoolBuilder
impl Sync for ClientPoolBuilder
impl Unpin for ClientPoolBuilder
impl UnsafeUnpin for ClientPoolBuilder
impl !UnwindSafe for ClientPoolBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more