Loading tutorials
Result with the ? operator. You do not need to have written async code before. By the end you will know what a future is, what poll does, and what the common mistakes look like.4 min readmove, and the Future trait from the previous chapter. The examples use Tokio with the full feature in Cargo.toml. They use .await and #[tokio::main] as given. Later chapters cover how they work.4 min readasync fn and async blocks (previous chapter), know that a future is a value implementing Future, and have Tokio in Cargo.toml with the full feature. Here you learn what .await does, where it is allowed, and the mistakes it causes most often.3 min readFuture trait and Poll, and that you can write async fn and .await. It also assumes you can run a program with Tokio (add tokio with the "full" feature in Cargo.toml).3 min readmove, Result and ?, and how to add a dependency with feature flags in Cargo. You should also know the earlier chapters' ideas: an async fn returns a future, and a future does nothing until something5 min readasync fn, use .await, and start a Tokio runtime with #[tokio::main]. It also assumes you know Result and ?. The examples use Tokio with the full feature in Cargo.toml.4 min readasync fn and .await, and that you can start a Tokio runtime with #[tokio::main]. It also assumes you know what move closures and Result do. The Send and 'static requirements for spawned futures get their own chapter, so here they appear only when they4 min readSend and Sync marker traits at a basic level, Arc and Rc, and the move keyword on closures. It also assumes you can start a Tokio runtime and call tokio::spawn. By the end you should be able to read the two most common spawn co4 min readasync fn, use .await, and start a Tokio runtime with #[tokio::main]. It also assumes you know that futures do nothing until they are polled. Here you will learn how to run several futures at the same time. You will also learn how to stop waiting when the firs4 min readResult, the ? operator and the From trait in ordinary Rust. It also assumes you can write async fn, use .await, and start a Tokio runtime. The chapter covers where ? returns to inside async code, how errors from timeouts and spawned tasks combine with your o3 min readtokio::spawn, that you know why spawned tasks need Send and 'static, and that you are comfortable with Arc and move closures. Tasks often need to cooperate. Because a spawned future must be 'static, it cannot borrow local variables from its p4 min readasync fn, use .await, and spawn tasks on Tokio. It also assumes you know basic thread concepts and the Arc and Mutex types. By the end you will be able to spot code that stalls the runtime and move it somewhere safe.5 min readasync fn, use .await, and run a Tokio program. You should also know what Drop does and how tokio::spawn, join!, and select! are used. Here you will learn what cancellation is in async Rust, what runs when it happens, and how to write code that survives 4 min readFuture trait and Poll from earlier in the tutorial. It also assumes you are comfortable with Arc, Mutex, and threads. By the end you will know what a waker is, who calls it, and why a future that returns Pending without arranging a wake-up can hang forever5 min readFuture and poll from earlier chapters. It explains why poll takes Pin<&mut Self> instead of &mut Self, what Unpin means, and the errors you meet when you poll futures by hand.5 min readFuture, Poll, Pin, and the .await keyword from the earlier chapters. You should also be comfortable with enums and match. Here you will see what async fn turns into: an anonymous type that implements Future.4 min readasync fn, use .await, spawn Tokio tasks, and read trait definitions that involve Pin<&mut Self>. It covers the Stream trait, how to consume and build streams, and the mistakes people commonly make with them.4 min readasync fn returns a future, how .await and tokio::spawn work, and the basics of traits, generics, and Send. Since Rust 1.75, a trait can declare async fn methods directly. The syntax is simple, but there are limits around Send and trait objects.4 min read