Loading tutorials
async fn works. Later chapters on async closures and async methods in traits build on it.3 min readasync fn and .await. It refreshes how closures work, because async closures are built on the same ideas.3 min readFn, FnMut and FnOnce traits, and basic async/.await. Before Rust 1.85 there was no async closure syntax. Code that needed an "async callback" used a pattern built from parts you already know.3 min readFn, FnMut, and FnOnce differ, and how async fn and .await work. The previous chapter showed the pattern |x| async move { ... }, which is a normal closure that returns a future. It works well when the future owns everything2 min readFn traits, async fn and .await, and the idea that a future does nothing until it is polled. The chapter before this one showed the older pattern, |x| async move { ... }. Here you will write the same logic as an async closure, available 2 min readFn, FnMut, and FnOnce traits, basic async/await, and generic trait bounds. You have seen that async |x| ... creates an async closure. Now you will learn how to write a function that accepts one.2 min readFn, FnMut and FnOnce traits, the basics of lifetimes, and the AsyncFn bounds from the previous chapter. It explains what an async closure's future is allowed to borrow, and why the older |x| async move { ... } pattern can't express it.2 min readasync fn methods in a trait, implement them, and call them from generic code. It assumes you know Rust ownership and lifetimes, closures, async/.await basics, and how to write traits with generics and bounds.2 min readasync fn returns a lazy future, how traits and generic bounds work, and basic lifetime elision. It explains what the compiler turns a trait's async fn into, because that explains the Send and dyn limits in the next chapters.3 min readasync fn returns a lazy future, how to write generic functions with trait bounds, and that tokio::spawn needs a Send future. It covers why async fn in a trait does not promise Send, and how to add that promise.3 min readdyn Trait works at a basic level, and what Pin and Box do. It builds on the previous chapters on async fn in traits and how it desugars to -> impl Future.3 min readasync fn in traits works, why it is not dyn compatible, and how to write a boxed future by hand. It covers when the async_trait crate is worth adding.3 min readFn traits, can write basic async/await code, and understand trait bounds. It does not introduce new syntax. It helps you pick between the options from the earlier chapters.3 min read