When I build my own futures, especially when they involve asynchronous I/O, I often end up using oneshot channels to notify about request completions. In particular,I very frequently use the pattern where you spawn a long-running "connection" future that reads from a
and sends responses on the oneshot channels as it handles incoming requests one at a time.
Pointing users in this direction might be good. A good example to refer them to might be tokio-zookeeper, because there's also a live-coding session where I build up that pattern here.
I just stumbled across this PR that adds tokio::spawn_handle and thought it's worth to mention it here. It basically provides the same functionality as oneshot::spawn.
When I build my own futures, especially when they involve asynchronous I/O, I often end up using oneshot channels to notify about request completions. In particular,I very frequently use the pattern where you spawn a long-running "connection" future that reads from a
and sends responses on the oneshot channels as it handles incoming requests one at a time.
Pointing users in this direction might be good. A good example to refer them to might be
tokio-zookeeper
, because there's also a live-coding session where I build up that pattern here.