async-tls icon indicating copy to clipboard operation
async-tls copied to clipboard

Export rustls crates

Open FssAy opened this issue 2 years ago • 0 comments

The rustls and rustls-pemfile in my opinion should be exported by async-tls as the library exposes functionality that requires a deep understanding of the types and functionality of the rustls crate. The current state requires user to import the rustls crate on their own while it might cause errors while importing the wrong version. For example:

async_tls::TlsAcceptor::from(std::sync::Arc(
     rustls::ServerConfig::builder().with_safe_defaults()?
));
the trait `From<std::sync::Arc<rustls::ServerConfig>>` is not implemented for `TlsAcceptor`
the following other types implement trait `From<T>`:
      <TlsAcceptor as From<std::sync::Arc<rustls::server::server_conn::ServerConfig>>>

This simple change would eliminate the issue:

async_tls::TlsAcceptor::from(std::sync::Arc(
     async_tls::rustls::ServerConfig::builder().with_safe_defaults()?
));

FssAy avatar Feb 05 '23 14:02 FssAy