Loading tutorials
async fn code and called .await. Here you learn what a Future is as a type. The details of polling, wakers and pinning come in the following chapters, so 5 min readPoll enum and the contract around Future::poll. It assumes you know Rust enums and pattern matching, can read trait signatures, and have seen Future described as a value that may not be ready yet. Wakers get a short mention here and a full chapter later.4 min readasync fn code and call .await. It also assumes you know traits, generics, impl Trait return types, and basic lifetimes. The previous chapters covered the Future trait and Poll. Here you will see what the async and .await keywords turn into.4 min readFuture and Poll are, and that you have written simple async fn code. It also assumes you can read enums and match. Here you will see what the compiler builds from an async fn, and you will write that structure by hand.4 min readFuture trait, Poll::Ready and Poll::Pending, and what Arc and Mutex do. You should also be comfortable reading Pin<&mut Self> in a poll signature, even if you don't yet know why it is there.5 min readPoll::Ready and Poll::Pending mean, and that a Waker is how a future asks to be polled again. It also assumes you can use Arc, Mutex, and thread::spawn. Here you will implement Future twice, then run both futures on a small executor.3 min readFuture and poll from earlier chapters. It explains why Future::poll takes Pin<&mut Self> and not &mut Self. The next chapter introduces Pin itself.5 min readFuture trait with poll. You should also know that an async block compiles to a state machine, and that such a state machine can hold references into itself. Here we look at how Pin stops a value from mov5 min readPin<P> promises and why a self-referential future must not move. It also assumes you are comfortable with auto traits and marker traits. Here you will learn which types the "will not move" promise applies to, how that is decided, and how to opt a type in.4 min readPin promises, what Unpin means, and why a self-referential future must not move. Here you will learn the three tools you use every day: Box::pin, std::pin::pin!, and Pin::as_mut. You will also learn the errors you are likely to hit.5 min readFuture, Poll, Context, and Waker are, and how Pin<&mut T> appears in the signature of poll. Here you put those pieces together into an executor. An executor is the code that actually calls poll. Without one, a future does nothing.5 min readFuture trait, Pin<&mut T>, and Unpin. It also assumes you have written a poll method by hand. Here you will see how a wrapper future polls the future inside it, and how to do that without unsafe in your own code.4 min readPoll, Waker, Pin, and block_on. You should also know how Arc and threads work. Here you will see how several futures run inside one program: combined in a single task with join or select, or given their own task with spawn.4 min readFuture, poll, wakers, and Pin. You should know that an async fn compiles to a state machine and that an executor drives it by calling poll. Here you will see what happens when nobody polls a future again.4 min readSend and Sync marker traits, Arc, and how an async fn becomes a state machine. Earlier chapters covered that last point. Here you will learn which values make a future !Send, how to read the compiler's complaint, and how to fix it.4 min readFuture, poll, Waker, and a basic executor like block_on work, and that you have used threads and Arc. It explains what a runtime adds on top of an executor, and why a blocking call inside a task can freeze unrelated work.6 min read