async-rs / async-tls

A TLS implementation over AsyncRead and AsyncWrite
https://async.rs
Apache License 2.0
167 stars 47 forks source link

TlsConnector::connect() returning a Result<Future<Item=Result<_,_>> is inconvenient #10

Closed sdroege closed 4 years ago

sdroege commented 4 years ago

It requires writing

let conn = connector.connect(...)?.await?;

i.e. two question marks around the `await.

It might be nicer to always return a future, and in case of failure it would simply be a future::ready(the_error). I.e. immediately resolve to the error when polling.

skade commented 4 years ago

I agree. I marked this issue as a good first issue.

sdroege commented 4 years ago

If you agree with the idea I can prepare a PR :)

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.