pub struct HttpClient { /* private fields */ }Expand description
Reusable, cheaply cloneable HTTP client with shared base URL, default headers, TLS roots, and keep-alive pooling.
Implementations§
Source§impl HttpClient
Inherent implementation of HttpClient.
impl HttpClient
Inherent implementation of HttpClient.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new reusable HttpClient with persistent keep-alive pooling enabled by default.
§Returns
Self- Fresh reusable HTTP client.
Sourcepub fn builder() -> HttpClientBuilder
pub fn builder() -> HttpClientBuilder
Returns a HttpClientBuilder for customizing base URL, default headers, timeouts, TLS roots, and retries.
§Returns
HttpClientBuilder- Fluent client builder.
Sourcepub fn request<T>(&self, method: Method, path_or_url: T) -> RequestBuilder
pub fn request<T>(&self, method: Method, path_or_url: T) -> RequestBuilder
Creates a RequestBuilder pre-populated with this client’s defaults for method and path_or_url.
§Arguments
Method- HTTP method to send.T- Absolute URL or path relative tobase_url.
§Returns
RequestBuilder- Pre-configured request builder ready for optional customization and.send()/.send_async().
Sourcepub fn get<T>(&self, path_or_url: T) -> RequestBuilder
pub fn get<T>(&self, path_or_url: T) -> RequestBuilder
Sourcepub fn post<T>(&self, path_or_url: T) -> RequestBuilder
pub fn post<T>(&self, path_or_url: T) -> RequestBuilder
Sourcepub fn put<T>(&self, path_or_url: T) -> RequestBuilder
pub fn put<T>(&self, path_or_url: T) -> RequestBuilder
Sourcepub fn delete<T>(&self, path_or_url: T) -> RequestBuilder
pub fn delete<T>(&self, path_or_url: T) -> RequestBuilder
Sourcepub fn patch<T>(&self, path_or_url: T) -> RequestBuilder
pub fn patch<T>(&self, path_or_url: T) -> RequestBuilder
Sourcepub fn head<T>(&self, path_or_url: T) -> RequestBuilder
pub fn head<T>(&self, path_or_url: T) -> RequestBuilder
Trait Implementations§
Source§impl Clone for HttpClient
impl Clone for HttpClient
Source§impl Debug for HttpClient
impl Debug for HttpClient
Source§impl Default for HttpClient
Default construction for HttpClient.
impl Default for HttpClient
Default construction for HttpClient.
Source§fn default() -> Self
fn default() -> Self
Creates a default HttpClient with persistent keep-alive pooling enabled.
§Returns
Self- Default reusable HTTP client.
Auto Trait Implementations§
impl Forget for HttpClient
impl Freeze for HttpClientwhere
*const ArcInner<HttpClientInner> is !null: Freeze,
PhantomData<ArcInner<HttpClientInner>>: Freeze,
impl Move for HttpClient
impl RefUnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin for HttpClientwhere
*const ArcInner<HttpClientInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<HttpClientInner>>: UnsafeUnpin,
impl UnwindSafe for HttpClientwhere
Arc<HttpClientInner>: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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