@jyn And yes JS only has the latter model -- every JS async call is a tokio::spawn basically
Top-level
8 comments
@predrag @jyn let's say you're traversing a Merkle linked list (in this case a chain of source control commits) to fold over them recursively -- if you just create a child future with the recursive call then await it, your task stack will grow in an unbounded fashion. If you spawn a new task for each node instead, this isn't an issue @predrag @jyn Good question! This is best modeled by a oneshot channel: https://docs.rs/tokio/latest/tokio/sync/oneshot/index.html |
@jyn (When I first started writing async Rust, with futures 0.1, I didn't understand the difference until almost a year in lol...
the first time I used an executor, it was to trampoline a recursive traversal of an arbitrary-depth graph, not to run pieces of code in parallel