Loading tutorials
if let, while let, let else, and let chains are all built on patterns, and match is the construct where patterns are easiest to see. This chapter sets up the working model that the rest of the tutorial relies on. It covers what a pattern is, how match checks patterns, which pattern forms y6 min readOption and Result, and read a match expression. It also assumes you know what a borrow is. The chapter explains the property that decides which pattern constructs you can use in a given place: whether a pattern can fail to match.6 min readOption and Result enums, match with simple patterns, and the basics of ownership and borrowing. It covers the plain form of if let: what it expands to, how bindings and moves behave, and the mistakes people make with it. Adding else bran4 min readOption and Result, match with basic patterns, and the idea of refutable patterns from the earlier chapters. It also assumes you have seen a bare if let with no else. Here you will see how if let gets a fallback branch, how to chain several pattern tests, and5 min readOption and Result, match, the idea of refutable patterns from the earlier chapters, and basic ownership and borrowing. It also assumes you have used if let. while let is the loop version of the same idea.6 min readOption and Result, match, and the basics of ownership and borrowing: moves, & references, and Copy types. It covers what happens to the names and values a pattern introduces. The same rules apply to if let, while let, let else, and let chains, so they ar6 min readOption and Result, how match works, and the difference between refutable and irrefutable patterns. It also assumes you have read the if let chapters. Everything here compiles on stable Rust 1.65 or newer in any edition.6 min readlet else basics, Option and Result, and how match arms must all have a compatible type. It explains the one compile-time rule that shapes every let else: the else block must never finish normally. It also shows how to satisfy that rule and what the compiler 5 min readOption and Result, the basic if let form with an optional else, and how a block limits the lifetime of a variable. It covers what goes wrong when several if let checks depend on each other, and why that shape motivates the features in the next chapters.6 min readmatch, Option and Result, if let, while let, and let else. It also assumes you know what refutable patterns are, and that you have seen the nesting that appears when several if let blocks depend on one another. A let chain removes that nesting. It joins pa5 min readif let, while let, let else, and let chains, and that you can run cargo build. It covers what each construct needs from your toolchain, what the errors look like when you don't have it, and how to upgrade safely.7 min readif let ... else, Option and Result, ownership and borrowing, and what a Drop implementation does. You should also have read the earlier chapters on if let, else, and let chains.6 min readOption and Result, basic match patterns, and ownership and borrowing. You also need to know what refutable and irrefutable patterns are, and what each construct does on its own. Here you will learn how to choose between them. The selection rules are short, and a f6 min read