ntex_h2::client

Struct ClientBuilder

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

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.