[][src]Struct ntex::http::client::Connector

pub struct Connector { /* fields omitted */ }

Manages http client network connectivity.

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

use std::time::Duration;
use ntex::http::client::Connector;

let connector = Connector::default()
     .timeout(Duration::from_secs(5))
     .finish();

Methods

impl Connector[src]

pub fn new(resolver: AsyncResolver) -> Connector[src]

impl Connector[src]

pub fn timeout(self, timeout: Duration) -> Self[src]

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

pub fn openssl(self, connector: OpensslConnector) -> Self[src]

Use custom SslConnector instance.

pub fn rustls(self, connector: Arc<ClientConfig>) -> Self[src]

pub fn limit(self, limit: usize) -> Self[src]

Set total number of simultaneous connections per type of scheme.

If limit is 0, the connector has no limit. The default limit size is 100.

pub fn keep_alive(self, dur: Duration) -> Self[src]

Set keep-alive period for opened connection.

Keep-alive period is the period between connection usage. If the delay between repeated usages of the same connection exceeds this period, the connection is closed. Default keep-alive period is 15 seconds.

pub fn lifetime(self, dur: Duration) -> Self[src]

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 75 seconds.

pub fn disconnect_timeout(self, dur: Duration) -> Self[src]

Set server connection disconnect timeout in milliseconds.

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

To disable timeout set value to 0.

By default disconnect timeout is set to 3000 milliseconds.

pub fn connector<T, U>(self, connector: T) -> Self where
    U: AsyncRead + AsyncWrite + Unpin + 'static,
    T: Service<Request = TcpConnect<Uri>, Response = (U, Protocol), Error = ConnectError> + 'static, 
[src]

Use custom connector to open un-secured connections.

pub fn secure_connector<T, U>(self, connector: T) -> Self where
    U: AsyncRead + AsyncWrite + Unpin + 'static,
    T: Service<Request = TcpConnect<Uri>, Response = (U, Protocol), Error = ConnectError> + 'static, 
[src]

Use custom connector to open secure connections.

pub fn finish(
    self
) -> impl Service<Request = Connect, Response = impl Connection, Error = ConnectError> + Clone
[src]

Finish configuration process and create connector service. The Connector builder always concludes by calling finish() last in its combinator chain.

Trait Implementations

impl Default for Connector[src]

Auto Trait Implementations

impl !RefUnwindSafe for Connector

impl !Send for Connector

impl !Sync for Connector

impl Unpin for Connector

impl !UnwindSafe for Connector

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,