pub trait ConfigExt: Sealed {
// Required methods
fn base_uri_layer(&self) -> BaseUriLayer;
fn auth_layer(&self) -> Result<Option<AuthLayer>, Error>;
fn extra_headers_layer(&self) -> Result<ExtraHeadersLayer, Error>;
fn openssl_https_connector(
&self,
) -> Result<HttpsConnector<HttpConnector>, Error>;
fn openssl_https_connector_with_connector<H>(
&self,
connector: H,
) -> Result<HttpsConnector<H>, Error>
where H: Service<Uri> + Send,
<H as Service<Uri>>::Error: Into<Box<dyn Error + Send + Sync>>,
<H as Service<Uri>>::Future: Send + 'static,
<H as Service<Uri>>::Response: Read + Write + Connection + Unpin;
fn openssl_ssl_connector_builder(
&self,
) -> Result<SslConnectorBuilder, Error>;
}
Expand description
Extensions to Config
for custom Client
.
See Client::new
for an example.
This trait is sealed and cannot be implemented.
Required Methods§
Sourcefn base_uri_layer(&self) -> BaseUriLayer
fn base_uri_layer(&self) -> BaseUriLayer
Layer to set the base URI of requests to the configured server.
Sourcefn auth_layer(&self) -> Result<Option<AuthLayer>, Error>
fn auth_layer(&self) -> Result<Option<AuthLayer>, Error>
Optional layer to set up Authorization
header depending on the config.
Sourcefn extra_headers_layer(&self) -> Result<ExtraHeadersLayer, Error>
fn extra_headers_layer(&self) -> Result<ExtraHeadersLayer, Error>
Layer to add non-authn HTTP headers depending on the config.
Sourcefn openssl_https_connector(
&self,
) -> Result<HttpsConnector<HttpConnector>, Error>
fn openssl_https_connector( &self, ) -> Result<HttpsConnector<HttpConnector>, Error>
Create [hyper_openssl::HttpsConnector
] based on config.
§Example
let config = Config::infer().await?;
let https = config.openssl_https_connector()?;
Sourcefn openssl_https_connector_with_connector<H>(
&self,
connector: H,
) -> Result<HttpsConnector<H>, Error>
fn openssl_https_connector_with_connector<H>( &self, connector: H, ) -> Result<HttpsConnector<H>, Error>
Create [hyper_openssl::HttpsConnector
] based on config and connector
.
§Example
let mut http = HttpConnector::new();
http.enforce_http(false);
let config = Config::infer().await?;
let https = config.openssl_https_connector_with_connector(http)?;
Sourcefn openssl_ssl_connector_builder(&self) -> Result<SslConnectorBuilder, Error>
fn openssl_ssl_connector_builder(&self) -> Result<SslConnectorBuilder, Error>
Create openssl::ssl::SslConnectorBuilder
based on config.
§Example
let config = Config::infer().await?;
let https = {
let mut http = HttpConnector::new();
http.enforce_http(false);
let ssl = config.openssl_ssl_connector_builder()?;
hyper_openssl::client::legacy::HttpsConnector::with_connector(http, ssl)?
};
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.