I am getting this error when I try using this function https://docs.rs/awc/2.0.3/awc/struct.Connector.html#method.rustls
async fn get_client_config() -> rustls::client::ClientConfig {
let root_certs = rustls::RootCertStore::empty();
rustls::ClientConfig::builder()
.with_safe_defaults()
.with_root_certificates(root_certs)
.with_no_client_auth()
}
async fn get_client() -> Client {
let client_config: rustls::client::ClientConfig = get_client_config().await;
// Error in next line.
let connector = Connector::new().rustls(client_config).finish();
ClientBuilder::new().connector(connector).finish()
}
error[E0308]: mismatched types
--> src/main.rs:31:59
|
31 | let connector = awc::Connector::new().rustls(Arc::new(client_config)).finish();
| ^^^^^^^^^^^^^ expected struct `rustls::client::ClientConfig`, found struct `ClientConfig`
[dependencies]
awc = "2.0.3"
actix-web = "3.3.2"
futures-util = "0.3.17"
rustls = "0.20.1"
actix-http = {version="2.2.1", features = ["rustls"]}