Loading tutorials
match.2 min readmatch selects a branch, how it extracts data from a variant, and which rules its arms must follow.2 min readmatch, and that you can build and run a program with cargo.3 min readimpl blocks on structs, and the difference between self, &self, and &mut self. It also assumes you can write a basic match. Here you attach methods to enums so the behavior lives next to the data.2 min readmatch expressions, and read basic Rust function signatures. It covers how Option<T> represents a value that may be missing and how to handle it.2 min readmatch branches on a value, and that a match must cover every case. Here you will learn the four simple pattern kinds that match arms use to test values.2 min readmatch expression, and enums whose variants carry data. Destructuring means writing a pattern that mirrors the shape of a value, so Rust pulls the parts out into new variables in one step.2 min readmatch, know the range and or-patterns from the previous chapters, and understand destructuring of enums and structs. It covers two tools that refine a pattern: guards, which add a condition, and @ bindings, which name a value while you test it.2 min readmatch and Option<T>. A full match is exhaustive, so it can be wordy when you care about only one pattern. Rust has four shorter forms for that case.2 min readOption and match work, and the basics of ownership. By the end you will be able to return a Result from a function, handle it with match, and use ? to pass errors up to the caller.3 min readmatch and destructuring work. It covers one question: when a pattern binds a variable, does the variable take ownership of the data, or does it borrow it?2 min readResult<T, E> and the ? operator work, and that you can write a match over enum variants. Here you will build your own error type so a function can report several kinds of failure through one Result.2 min readmatch expressions, and add methods with impl. It also assumes you understand moves and borrows.2 min readmatch expressions, and borrow values. It covers why a recursive enum needs Box and how to build and walk one.2 min readmatch, and derive traits such as Debug. It covers enums whose variants carry no data, the integer value behind each variant, and how to convert between the two.2 min read