-
Notifications
You must be signed in to change notification settings - Fork 13
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
Enter tokio context outside of a future #21
Comments
I'm more of a fan of the second option. You shouldn't need |
Yes, |
Just realized that |
pin-project-lite supports custom Drop impl: taiki-e/pin-project-lite#25 |
I doubt the overhead is noticeable, especially since most futures and I/O types can use the non-zero optimization. |
Right, but given I'm working on a PR right now and it's quite gnarly (which might be due to |
The value of a pinned type can be overwritten with |
Oohh, clever! I was aware of that method, but hadn't connected the dots. That should indeed make an |
Sometimes, non-
poll
methods expect to be able to spawn tasks. One common case isDrop
implementations of types that want to do someasync
cleanup. Would you accept PRs for any of the following?enter_tokio_context
+TokioEnterGuard
wrappingTOKIO1.enter()
impl Drop<T> for Compat<T>
that enters the tokio context while dropping the inner value (requires someunsafe
forManuallyDrop
, I think)The text was updated successfully, but these errors were encountered: