pub struct ClientBuilder(/* private fields */);
Expand description

Manages http client network connectivity.

The ClientBuilder type uses a builder-like combinator pattern for service construction that finishes by calling the .finish() method.

Implementations§

source§

impl ClientBuilder

source

pub fn with_default<A, U>(addr: U) -> Self
where A: Address + Clone, Connect<A>: From<U>,

source§

impl ClientBuilder

source

pub fn scheme(self, scheme: Scheme) -> Self

Set client’s connection scheme

source

pub fn memory_pool(self, id: PoolId) -> Self

Set memory pool.

Use specified memory pool for memory allocations. By default P5 memory pool is used.

source

pub fn timeout<T: Into<Millis>>(self, timeout: T) -> Self

Connection timeout.

i.e. max time to connect to remote host including dns name resolution. Set to 1 second by default.

source

pub fn max_streams(self, limit: u32) -> Self

Set total number of simultaneous streams per connection.

If limit is 0, the connector uses “MAX_CONCURRENT_STREAMS” config from connection settings. The default limit size is 100.

source

pub fn lifetime(self, dur: Seconds) -> Self

Set max lifetime period for connection.

Connection lifetime is max lifetime of any opened connection until it is closed regardless of keep-alive period.

Default lifetime period is not set.

source

pub fn minconn(self, num: usize) -> Self

Sets the minimum concurrent connections.

By default min connections is set to a 1.

source

pub fn maxconn(self, num: usize) -> Self

Sets the maximum concurrent connections.

By default max connections is set to a 16.

source

pub fn disconnect_timeout<T: Into<Millis>>(self, timeout: T) -> Self

Set server connection disconnect timeout.

Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the socket get dropped.

To disable timeout set value to 0.

By default disconnect timeout is set to 3 seconds.

source

pub fn configure<O, R>(self, f: O) -> Self
where O: FnOnce(&Config) -> R,

Configure http2 connection settings

source

pub fn config(&self) -> &Config

Http/2 connection settings

source

pub fn connector<A, U, T, F>(self, addr: U, connector: F) -> Self
where A: Address + Clone, F: IntoService<T, Connect<A>>, T: Service<Connect<A>, Error = ConnectError> + 'static, IoBoxed: From<T::Response>, Connect<A>: From<U>,

Use custom connector

source

pub fn finish(self) -> Client

Finish configuration process and create connections pool.

Trait Implementations§

source§

impl Debug for ClientBuilder

source§

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

Formats the value using the given formatter. 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.