Loading tutorials
Drop) and the async/await syntax. It also assumes you have used #[tokio::main] and tokio::spawn. Later chapters build on the idea here: cancelling a future means dropping it, and that only makes sense once you know a future does 2 min readDrop trait. It also assumes you know async/await syntax and how to use #[tokio::main] and tokio::spawn. The previous chapter showed that a future does nothing until something polls it. This chapter covers the other half:2 min readDrop trait), async/await syntax, and how to start a Tokio runtime with #[tokio::main] and tokio::spawn.2 min read#[tokio::main], tokio::spawn), and the Drop trait. Earlier chapters showed that a future does nothing until it is polled, and that cancelling a future means dropping it. timeout puts those two ideas to practical use.2 min readtimeout. Here you will use tokio::select! to wait on several futures and act on the first one that finishes.2 min readDrop trait, async/await basics, tokio::spawn, and tokio::sync::mpsc. It also assumes you know that select! drops the futures that lose the race.3 min readtokio::select!, that dropping a future cancels it, and what cancel safety means. You should also be comfortable with tokio::sync::mpsc and tokio::spawn.2 min readDrop trait, async/await basics, and how to use #[tokio::main] and tokio::spawn. Earlier chapters showed that cancelling a future means dropping it. Here we look at what that drop does to the state the future holds.2 min readtokio::spawn, and that dropping a future cancels it. Earlier chapters showed that dropping a future stops it at its next await point. Spawned tasks follow different rules.2 min readtokio::select!, tokio::spawn, and what cancel safety means. Dropping a future or aborting a task stops work at the next await point, and the code gets no say in where. A CancellationToken lets the work choose its own stopping point.2 min readtokio::spawn, JoinHandle), the select! macro, Drop, and the earlier chapters on cancellation by drop and CancellationToken. A graceful shutdown combines those pieces. It tells tasks to stop, waits for them to finish their current step, and releas2 min readtimeout and select! cancel a future by dropping it. It covers the case where that mechanism cannot act.2 min read#[tokio::test], tokio::time::sleep, and tokio::time::timeout. You should also know that a timeout drops the future it wraps when the deadline passes.3 min read