this post was submitted on 05 Sep 2024
58 points (100.0% liked)
Rust
5980 readers
178 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The most interesting part here is the polling only has to take place on the scope itself. That was actually what I wanted to check, but got distracted because all spawns are awaited in the scope in
moro
's README example.The non-awaited jobs are run concurrently as the moro docs say. But what if we immediately await f2?
f1 and f2 are run concurrently, f3 is run after f2 finishes, but doesn't have to wait for f1 to finish, which is maybe obvious, but... (see below).
So two things here:
defer_to_scope()
be confusing if the job is awaited in the scope?