#[non_exhaustive]pub struct HttpClient(/* private fields */);Expand description
Opaque HTTP client returned by TransportConfig::build_client
(bd:JMAP-6r7c.36).
The inner third-party type is private; the wrapper exists so the JMAP
transport identity does not leak through the public trait signature.
A future swap of the underlying HTTP library (e.g. ureq, hyper-util
directly, curl) replaces the wrapped type without breaking any
downstream extension client or custom TransportConfig impl that
returns Result<HttpClient, ClientError> from build_client.
Custom transports construct via HttpClient::new — that signature
still references reqwest::Client (the only construction path the
kit knows how to make HTTP requests against). The partial-wrap
argument mirrors ParseError /
SerializeError: the variant
payload / return type is opaque, but the construction signature still
names the third-party type so callers have a way in. A future
transport swap would deprecate this constructor in favor of an
analogous one for the new HTTP client; the wrapper type itself
stays stable.
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn new(client: Client) -> Self
pub fn new(client: Client) -> Self
Wrap a reqwest::Client into an opaque HttpClient.
Custom TransportConfig impls use this constructor to wrap a
reqwest client they built with their own TLS / proxy / timeout
configuration:
impl TransportConfig for MyCustomTransport {
fn build_client(&self) -> Result<HttpClient, ClientError> {
let client = reqwest::ClientBuilder::new()
.proxy(...)
.build()
.map_err(ClientError::from_reqwest)?;
Ok(HttpClient::new(client))
}
}