[][src]Struct hyper::client::Config

pub struct Config<C, B> { /* fields omitted */ }

Configuration for a Client

Methods

impl<C, B> Config<C, B>[src]

pub fn body<BB>(self) -> Config<C, BB>[src]

Set the body stream to be used by the Client.

Example

let cfg = Config::default()
    .body::<hyper::Body>();

pub fn connector<CC>(self, val: CC) -> Config<CC, B>[src]

Set the Connect type to be used.

pub fn keep_alive(self, val: bool) -> Config<C, B>[src]

Enable or disable keep-alive mechanics.

Default is enabled.

pub fn keep_alive_timeout(self, val: Option<Duration>) -> Config<C, B>[src]

Set an optional timeout for idle sockets being kept-alive.

Pass None to disable timeout.

Default is 90 seconds.

pub fn http1_writev(self, val: bool) -> Config<C, B>[src]

Set whether HTTP/1 connections should try to use vectored writes, or always flatten into a single buffer.

Note that setting this to false may mean more copies of body data, but may also improve performance when an IO transport doesn't support vectored writes well, such as most TLS implementations.

Default is true.

pub fn retry_canceled_requests(self, val: bool) -> Config<C, B>[src]

Set whether to retry requests that get disrupted before ever starting to write.

This means a request that is queued, and gets given an idle, reused connection, and then encounters an error immediately as the idle connection was found to be unusable.

When this is set to false, the related FutureResponse would instead resolve to an Error::Cancel.

Default is true.

pub fn set_host(self, val: bool) -> Config<C, B>[src]

Set whether to automatically add the Host header to requests.

If true, and a request does not include a Host header, one will be added automatically, derived from the authority of the Uri.

Default is true.

impl<C, B> Config<C, B> where
    C: Connect,
    B: Stream<Error = Error>,
    B::Item: AsRef<[u8]>, 
[src]

pub fn build(self, handle: &Handle) -> Client<C, B>[src]

Construct the Client with this configuration.

pub fn executor<E>(self, executor: E) -> Client<C, B> where
    E: Executor<Background> + 'static, 
[src]

Construct a Client with this configuration and an executor.

The executor will be used to spawn "background" connection tasks to drive requests and responses.

impl<B> Config<UseDefaultConnector, B> where
    B: Stream<Error = Error>,
    B::Item: AsRef<[u8]>, 
[src]

pub fn build(self, handle: &Handle) -> Client<HttpConnector, B>[src]

Construct the Client with this configuration.

Trait Implementations

impl<C: Clone, B> Clone for Config<C, B>[src]

impl<C, B> Debug for Config<C, B>[src]

impl Default for Config<UseDefaultConnector, Body>[src]

Auto Trait Implementations

impl<C, B> RefUnwindSafe for Config<C, B> where
    B: RefUnwindSafe,
    C: RefUnwindSafe

impl<C, B> Send for Config<C, B> where
    B: Send,
    C: Send

impl<C, B> Sync for Config<C, B> where
    B: Sync,
    C: Sync

impl<C, B> Unpin for Config<C, B> where
    B: Unpin,
    C: Unpin

impl<C, B> UnwindSafe for Config<C, B> where
    B: UnwindSafe,
    C: UnwindSafe

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.