-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add AsyncRuntime::oneshot
#1025
Conversation
Signed-off-by: Anthony Griffon <anthony@griffon.one>
Signed-off-by: Anthony Griffon <anthony@griffon.one>
This PR seems to be generally fine. What's the reason closing it? @schreter make sense? |
Well, actually I'd like to have them part of the (and plus, we have issues with malfunction safety with Tokio primitives, so we replaced them - unfortunately, upstream there is not a big chance to get changes in this area accepted, since it would require changing some core concepts) |
I used specialization for this PR to have the As specialization is needed, it won't compile on stable anymore, so I need to find another way to do it without specialization, mb something like having a generic on EDIT: It seems I was just too tired yesterday, I can do it without -> #1026 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the non-generic code uses a concrete type, the specialization is not needed. You can also sort-of specialize using autoref specialization, see for instance here. We used it at couple of places in our project to do exactly that - call a different impl based on whether Debug
is supported or not (or another trait). Unfortunately, it doesn't work well in generic context (inside of a method taking T
you cannot autoref-specialize on T: Debug
, for instance).
I am also hoping that specialization will arrive soon - it is so much easier to do things with it.
Reviewable status: 0 of 22 files reviewed, all discussions resolved
Great! I've been looking for a method like this for a while! |
A draft for
AsyncRuntime::oneshot
, there is a clear cost associated to abstracting it this way, WDYT?Checklist
This change is