pub trait TransportConfig: Send + Sync {
// Required method
fn build_client(&self) -> Result<HttpClient, ClientError>;
}Expand description
Controls how the underlying HttpClient is constructed.
Implementations configure TLS trust roots, client certificates, and
connect timeouts. This is separate from credential injection
(see AuthProvider) so transports and credentials compose freely.
Implement this trait when you need custom TLS logic (e.g. a private CA
or a client certificate). For custom per-request credentials only,
implement AuthProvider instead. DefaultTransport covers the common
case of publicly-trusted TLS with no custom certificates.
Return type contract (bd:JMAP-6r7c.36). build_client returns an
opaque HttpClient wrapper, not a bare reqwest::Client. Custom
impls construct via HttpClient::new after building their reqwest
client; the wrapper insulates the trait’s public surface from a
future HTTP-transport swap.
Maintainer note (bd:JMAP-6lsm.19): if you add a new method to this
trait, update the manual blanket impl for Box<dyn TransportConfig> at
the bottom of this file. The crate ships a hand-written forwarding impl
for the boxed trait object so callers can store heterogeneous transport
configurations behind a single type. Adding a method here without
mirroring it on the blanket impl silently breaks the
JmapClient::new(Box::<dyn TransportConfig>::new(...)) call shape.
Required Methods§
Sourcefn build_client(&self) -> Result<HttpClient, ClientError>
fn build_client(&self) -> Result<HttpClient, ClientError>
Build the HttpClient for this transport configuration.
Trait Implementations§
Source§impl TransportConfig for Box<dyn TransportConfig>
impl TransportConfig for Box<dyn TransportConfig>
Source§fn build_client(&self) -> Result<HttpClient, ClientError>
fn build_client(&self) -> Result<HttpClient, ClientError>
HttpClient for this transport configuration.Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".