pub struct Client { /* private fields */ }Expand description
Async HTTP client.
The client manages connection pooling and shared configuration. Create one
with Client::new or Client::builder.
Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Create a ClientBuilder for configuring a client.
Sourcepub fn get(&self, url: &str) -> Result<RequestBuilder>
pub fn get(&self, url: &str) -> Result<RequestBuilder>
Create a GET request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn post(&self, url: &str) -> Result<RequestBuilder>
pub fn post(&self, url: &str) -> Result<RequestBuilder>
Create a POST request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn put(&self, url: &str) -> Result<RequestBuilder>
pub fn put(&self, url: &str) -> Result<RequestBuilder>
Create a PUT request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn patch(&self, url: &str) -> Result<RequestBuilder>
pub fn patch(&self, url: &str) -> Result<RequestBuilder>
Create a PATCH request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn delete(&self, url: &str) -> Result<RequestBuilder>
pub fn delete(&self, url: &str) -> Result<RequestBuilder>
Create a DELETE request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn head(&self, url: &str) -> Result<RequestBuilder>
pub fn head(&self, url: &str) -> Result<RequestBuilder>
Create a HEAD request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn options(&self, url: &str) -> Result<RequestBuilder>
pub fn options(&self, url: &str) -> Result<RequestBuilder>
Create an OPTIONS request builder for the given URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn request(&self, method: Method, url: &str) -> Result<RequestBuilder>
pub fn request(&self, method: Method, url: &str) -> Result<RequestBuilder>
Create a request builder for the given method and URL.
§Errors
Returns Error::InvalidUrl if url cannot be parsed.
Sourcepub fn pool_metrics(&self) -> &PoolMetrics
pub fn pool_metrics(&self) -> &PoolMetrics
Returns a reference to the connection pool metrics.
These count logical request-permit waits/cancellations. For
connector/protocol observations see Self::transport_metrics.
Sourcepub fn transport_metrics(&self) -> &TransportMetrics
pub fn transport_metrics(&self) -> &TransportMetrics
Returns a reference to the transport observability counters.
Counts connector events (DNS/connect/TLS attempts) and protocol connections (H3 sessions, 101 upgrades) where observable. Hyper socket-reuse counts are intentionally absent.