pub struct HttpClientBuilder { /* private fields */ }Expand description
Builder for configuring HTTP clients.
Provides a consistent way to configure HTTP clients across all API crates with sensible defaults.
§Example
use polyoxide_core::HttpClientBuilder;
let client = HttpClientBuilder::new("https://api.example.com")
.timeout_ms(60_000)
.pool_size(20)
.build()
.unwrap();Implementations§
Source§impl HttpClientBuilder
impl HttpClientBuilder
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a new HTTP client builder with the given base URL.
Sourcepub fn timeout_ms(self, timeout: u64) -> Self
pub fn timeout_ms(self, timeout: u64) -> Self
Set request timeout in milliseconds.
Default: 30,000ms (30 seconds)
Sourcepub fn pool_size(self, size: usize) -> Self
pub fn pool_size(self, size: usize) -> Self
Set connection pool size per host.
Default: 10 connections
Sourcepub fn build(self) -> Result<HttpClient, ApiError>
pub fn build(self) -> Result<HttpClient, ApiError>
Build the HTTP client.
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