Loading tutorials
select!. Later chapters build on it.5 min readtokio::spawn and #[tokio::main], and understand that a future is a value you poll. The previous chapter covered why a future does nothing until polled. This one covers where a future can be stopped once it is running.6 min readDrop trait, async/await syntax, and the basics of the Tokio runtime. It also assumes you have read the earlier chapters on lazy futures and await points. Here we put those two ideas together to explain how cancellation works in async Rust.6 min readDrop trait, async/await syntax, and the basics of the Tokio runtime (#[tokio::main], tokio::spawn). It builds on the previous chapters: a future does nothing until polled, a task can only stop at an await point, and cancelling a future mean5 min readDrop trait, async/await syntax, tokio::spawn, and tokio::sync::mpsc. You should also know that dropping a future cancels it, which the previous chapters covered. The examples need tokio = { version = "1", features = ["full"] } in5 min readDrop trait, async/await, and basic Tokio use (#[tokio::main], tokio::spawn, mpsc channels). It also assumes you have seen tokio::select! and know that the branches that lose a race are dropped. The examples need tokio with the `ful5 min readtokio::select!, that dropping a future cancels it, and what cancel safety means. It also assumes you can read async/await code and use tokio::spawn and mpsc channels. Here you will see what changes when select! runs inside a loop.5 min readasync/await, and basic Tokio use (#[tokio::main], tokio::spawn). It also assumes you know from earlier chapters that cancelling a future means dropping it, and that a future can only be dropped at an await point. Here we deal with the consequence5 min readtimeout and select!. It does not work for a task that runs on its own, such as a worker loop with state to flush or a connection to close. For those tasks you ask the task to stop and let it choose where and how. This is cooperative cancellation5 min readtokio::select!, CancellationToken, JoinHandle::abort and timeout, and that you have used tokio::spawn and mpsc channels.6 min readtokio::time::timeout and tokio::spawn work, and that cancellation means dropping a future. It explains why a timeout can't interrupt code that never reaches an .await. It then shows how to move blocking work off the async threads and how to stop it cooperative5 min read