[−][src]Struct chttp::client::ClientBuilder
An HTTP client builder, capable of creating custom Client
instances with customized
behavior.
Example:
use chttp::{http, Client, Options, RedirectPolicy}; use std::time::Duration; let client = Client::builder() .options(Options::default() .with_timeout(Some(Duration::from_secs(60))) .with_redirect_policy(RedirectPolicy::Limit(10)) .with_preferred_http_version(Some(http::Version::HTTP_2))) .build()?; let mut response = client.get("https://example.org")?; let body = response.body_mut().text()?; println!("{}", body);
Methods
impl ClientBuilder
[src]
pub fn options(&mut self, options: Options) -> &mut Self
[src]
Set the default connection options to use for each request.
If a request has custom options, then they will override any options specified here.
pub fn build(&self) -> Result<Client, Error>
[src]
Build an HTTP client using the configured options.
If the client fails to initialize, an error will be returned.
Trait Implementations
impl Default for ClientBuilder
[src]
fn default() -> ClientBuilder
[src]
impl Clone for ClientBuilder
[src]
fn clone(&self) -> ClientBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl Send for ClientBuilder
impl Sync for ClientBuilder
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.