Struct hyper::client::Config
[−]
[src]
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]
C: Connect,
B: Stream<Error = Error>,
B::Item: AsRef<[u8]>,
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]
E: Executor<Background> + 'static,
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]
B: Stream<Error = Error>,
B::Item: AsRef<[u8]>,
pub fn build(self, handle: &Handle) -> Client<HttpConnector, B>
[src]
Construct the Client with this configuration.
Trait Implementations
impl Default for Config<UseDefaultConnector, Body>
[src]
fn default() -> Config<UseDefaultConnector, Body>
[src]
Returns the "default value" for a type. Read more
impl<C, B> Debug for Config<C, B>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more