-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support for passing async fn into advertise_service
#108
Comments
If you're blocked on this you still have the option of calling |
I think it is definitely something we'd like to support if possible. It shouldn't be too hard to try experimenting with our internal type erasure to see if this works, but I'm suspicious we're going to hit some limitation of |
@ssnover agreed - i think it would just be nicer overall though for the functions to be async in general though. @Carter12s - thanks, makes sense. let me take a look at it and I'll take a stab at it if it seems relatively not difficult. |
Having glanced at this for a bit, the main challenge is our paradigm around type erasure with the closure. Async closures are unstable, which means the If you look at implementing this: I'd recommend |
Update! Async closures have merged! rust-lang/rust#132706 We should be able to build this out once the next version of rust ships (could build it out on nightly right now). Once built we can put it behind a feature flag to not affect out min rust version too much. But super excited this is coming. |
In the
service_server.rs
example, I've noticed that there is:and
my_service
is a simplefn
here, but many services are often going to require async/await type functions to run within the function. Is there plan to support async fn here?If not, I'm happy to look into creating a PR to add support for this especially because I'd like to use async functions within my service callback that I pass in.
The text was updated successfully, but these errors were encountered: