pub struct HttpClientBuilder { /* private fields */ }Expand description
Builder for HttpClient with configurable timeout settings.
§Example
use hookburn_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
Sourcepub const fn connect_timeout(self, timeout: Duration) -> Self
pub const fn connect_timeout(self, timeout: Duration) -> Self
Set the maximum time allowed to establish a TCP connection.
Sourcepub const fn request_timeout(self, timeout: Duration) -> Self
pub const 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, CoreError>
pub fn build(self) -> Result<HttpClient, CoreError>
Build the HttpClient.
§Errors
Returns an error if the underlying reqwest::Client cannot be
constructed (e.g. TLS backend unavailable).
Trait Implementations§
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