pub struct ClientBuilder { /* private fields */ }Expand description
A ClientBuilder can be used to create a Client with custom configuration.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new() -> Self
Available on non-crate feature async only.
pub fn new() -> Self
async only.Constructs a new ClientBuilder.
This is the same as Client::builder().
Sourcepub fn build(self) -> Result<Client, Error>
Available on non-crate feature async only.
pub fn build(self) -> Result<Client, Error>
async only.Returns a Client that uses this ClientBuilder configuration.
§Errors
This method fails if TLS backend cannot be initialized, or the resolver cannot load the system configuration.
Sourcepub fn user_agent<V>(self, value: V) -> ClientBuilder
Available on non-crate feature async only.
pub fn user_agent<V>(self, value: V) -> ClientBuilder
async only.Sets the User-Agent header to be used by this client.
Sourcepub fn default_headers(self, headers: HeaderMap) -> ClientBuilder
Available on non-crate feature async only.
pub fn default_headers(self, headers: HeaderMap) -> ClientBuilder
async only.Sets the default headers for every request
Sourcepub fn timeout<T>(self, timeout: T) -> ClientBuilder
Available on non-crate feature async only.
pub fn timeout<T>(self, timeout: T) -> ClientBuilder
async only.Set a timeout for connect, read and write operations of a Client.
Default is 30 seconds.
Pass None to disable timeout.
Sourcepub fn connect_timeout<T>(self, timeout: T) -> ClientBuilder
Available on non-crate feature async only.
pub fn connect_timeout<T>(self, timeout: T) -> ClientBuilder
async only.Set a timeout for only the connect phase of a Client.
Default is None.
Trait Implementations§
Source§impl Debug for ClientBuilder
Available on non-crate feature async only.
impl Debug for ClientBuilder
Available on non-crate feature
async only.Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more