Reputation: 139
fn connect_tls() -> Result<rustls::stream::Stream<rustls::client::ClientSession, TcpStream>, Box<dyn Error>> {}
gives
module `stream` is private
private module
module `client` is private
private module
Can the type somehow be inferred?
Upvotes: 2
Views: 250
Reputation: 58695
The modules client
and stream
are private, but client::ClientSession
and stream::Stream
are both exported by the rustls
crate at the top level. You should be able to just write this as:
fn connect_tls() -> Result<rustls::Stream<rustls::ClientSession, TcpStream>, Box<dyn Error>> {}
The documentation for rustls doesn't mention those private modules at all, so you will be just fine by using types as shown in the docs.
Upvotes: 2