pub struct HttpClientBuilder { /* private fields */ }Expand description
Builder for HttpClient with configurable timeout settings.
§Example
use hooksmith_core::HttpClientBuilder;
use std::time::Duration;
let client = HttpClientBuilder::new()
.connect_timeout(Duration::from_secs(5))
.request_timeout(Duration::from_secs(15))
.build()
.expect("failed to build client");Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
pub fn new() -> Self
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Set the maximum time allowed to establish a TCP connection.
Sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Set the maximum time allowed for a complete request/response cycle.
Defaults to 30 seconds when not set.
Sourcepub fn build(self) -> Result<HttpClient, Error>
pub fn build(self) -> Result<HttpClient, Error>
Build the HttpClient.
§Errors
Returns an error if the underlying reqwest::Client cannot be
constructed (e.g. TLS backend unavailable).
Trait Implementations§
Source§impl Default for HttpClientBuilder
impl Default for HttpClientBuilder
Source§fn default() -> HttpClientBuilder
fn default() -> HttpClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HttpClientBuilder
impl RefUnwindSafe for HttpClientBuilder
impl Send for HttpClientBuilder
impl Sync for HttpClientBuilder
impl Unpin for HttpClientBuilder
impl UnsafeUnpin for HttpClientBuilder
impl UnwindSafe for HttpClientBuilder
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