-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can runtime
arguments be made optional?
#977
Comments
I'd consider it. I hate relying on thread local storage for this stuff, it makes testing really difficult. Let me review our options in this area. It might be that we could pass in a |
Ok, I think we're going to handle this in the tokio library itself: tokio-rs/tokio#2040 Once that or something like it lands, we can then have a default method on trust-dns-resolver then takes the thread-local instantiated Handle, which will work in this case. |
FYI, with https://docs.rs/tokio/0.2.8/tokio/runtime/struct.Handle.html#method.current now in Tokio, users should be able to get a handle to the current runtime in a |
has this problem been resolved |
I think this has been solved? At least you can in 0.19 instantiate a |
Yes, this should be closed with the addition of the |
Having to pass a
tokio::runtime::Handle
in order to construct anAsyncResolver
(or aTokioConnectionProvider
) is slightly awkward because it means that programs which useAsyncResolver
can't be written with a main function declared using#[tokio::main]
. Programs which use#[tokio::main]
never explicitly construct a tokio runtime and have no means of obtaining a handle to the one that tokio implicitly constructs. Could theruntime
argument be madeOption
al, such that ifNone
is passed then the resolver will just spawn tasks on the default executor usingtokio::spawn()
?The text was updated successfully, but these errors were encountered: