Consider providing documentation about 'AsyncTask' vs 'async fn' #1559
michaeljones
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for the great project. It has been a smooth experience so far.
I am looking to provide an async function on the JavaScript side and it seems it is possible with both 'AsyncTask' and 'tokio + async fn'. I'm curious if there are factors to consider when choosing?
If I were to guess, I would say that 'async fn' is simpler and should be used if the user is happy including Tokio and doesn't need abort signals or 'finally' style clean up? But otherwise AsyncTask should be used instead as that doesn't require Tokio? It would be nice to have a little info box in the docs which explicitly lays out the considerations. I could try to write one if that would be useful but I have limited experience here.
Edit: Hmm, AsyncTask puts you on a libuv thread which is good for moving calculations off the main thread but doesn't help with using further async functionality at that point.
Beta Was this translation helpful? Give feedback.
All reactions