Struct chttp::client::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
Expand description
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);
Implementations
Trait Implementations
sourceimpl Clone for ClientBuilder
impl Clone for ClientBuilder
sourcefn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Default for ClientBuilder
impl Default for ClientBuilder
sourcefn default() -> ClientBuilder
fn default() -> ClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more