ClientBuilder

Struct ClientBuilder 

Source
pub struct ClientBuilder<A, T> { /* 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<A> ClientBuilder<A, Connector<A>>
where A: Address + Clone,

Source

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

Source§

impl<A, T> ClientBuilder<A, T>
where A: Address + Clone,

Source

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

Set client’s connection scheme

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 skip_unknown_streams(self) -> Self

Do not return error for frames for unknown streams.

This includes pending resets, data and window update frames.

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 connector<U, F>(self, connector: F) -> ClientBuilder<A, U>

Use custom connector

Source§

impl<A, T> ClientBuilder<A, T>
where A: Address + Clone, T: ServiceFactory<Connect<A>, SharedCfg, Error = ConnectError> + 'static, IoBoxed: From<T::Response>,

Source

pub async fn build(self, cfg: SharedCfg) -> Result<Client, T::InitError>

Finish configuration process and create connections pool.

Trait Implementations§

Source§

impl<A, T> Debug for ClientBuilder<A, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A, T> !Freeze for ClientBuilder<A, T>

§

impl<A, T> !RefUnwindSafe for ClientBuilder<A, T>

§

impl<A, T> !Send for ClientBuilder<A, T>

§

impl<A, T> !Sync for ClientBuilder<A, T>

§

impl<A, T> Unpin for ClientBuilder<A, T>
where T: Unpin, A: Unpin,

§

impl<A, T> !UnwindSafe for ClientBuilder<A, T>

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

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.