Expand description
One tokio task type for many spawn sites.
tokio::spawn and tokio::task::spawn_blocking are generic over the
future / closure, and each type compiles its own task machinery (poll,
harness, join handle: about 1.9 KiB per call site on x86_64). Stores run
every operation on the blocking pool, so a store with 30 methods paid for 30
task types. spawn and spawn_blocking erase the future / closure
behind a box (one allocation, which a spawn makes anyway), so the machinery
exists once for each.
Functionsยง
- spawn
- Spawns
futureon the current runtime, liketokio::spawn. - spawn_
blocking - Runs
jobon the blocking pool, liketokio::task::spawn_blocking.