Open kornelski opened 4 years ago
Ah, yes, we should clean this up. Probably deprecate the new
? Some of these changes have come in as we've genericized the AsyncResolver across runtimes beyond Tokio into Fuchsia and AsyncStd. I've tried to document this as best as possible, but that can always be better. We should probably recommend to use the AsyncStdResolver, https://docs.rs/async-std-resolver/0.19.4/async_std_resolver/, or the TokioResolver, https://docs.rs/trust-dns-resolver/0.19.4/trust_dns_resolver/type.TokioAsyncResolver.html.
I'm happy to have suggestions for how we improve the experience here.
Code like this:
fails to compile:
This is problematic, because:
R
doesn't mean anything. Rustc dug out some internal name that isn't related to anything I wrote. It's impossible to know what this refers to without looking it up.The documentation mentions
GenericConnectionProvider<R>
, butGenericConnectionProvider
is a private trait, so it is completely undocumented. I can't look up whatR
is supposed to be. I can't search for what types implement it. I can't name it the code.I had to read this crate's source code to discover that
TokioConnectionProvider
type alias exists and it happens to satisfy the mysteriousR
parameter. I'm surprised that thenew
function that takes a tokio handle is still generic over the runtime.Could you add
TokioConnectionProvider
as the default type for this implementation, or make a less genericnew_tokio
function that automatically specifies this type?