Loading tutorials
let bindings, structs), enums and match, ownership and borrowing basics, and generics and traits at a conceptual level. You should also be comfortable with simple closures and iterators.2 min readmatch, ownership and borrowing, and have a conceptual grasp of generics. Here you will see how Option<T> is defined, how to write functions that return it, and the mistakes people commonly make when first using it.2 min readmatch, and have a conceptual grasp of generics. You should also have read the previous chapter on Option<T>.2 min readmatch expressions, and ownership basics. You have seen that Option<T> and Result<T, E> are enums. Here you will learn the three ways to look inside them and act on each variant.2 min readOption<T>, Result<T, E>, and how to handle them with match. You should also know what a closure is.2 min readOption<T> works, how to use match, if let, and let else, and the basics of closures. Combinators are methods on Option that transform a value without a match. When the value is None, they pass the None along untouched.2 min readResult<T, E>, match, closures, and how Option combinators such as map and and_then work. Result combinators follow the same ideas. They apply to the Ok value, to the Err value, or to both in sequence, without a match each time.2 min readmatch on Option and Result, and that you know closures and the basic combinators map and unwrap_or. You will learn how to convert between the two types, and when each conversion loses information.2 min readmatch on Option and Result, and that you know the basics of generics and traits. You will learn what ? expands to, where it is allowed, and how it converts error types.2 min readmatch, the ? operator, and the basics of traits. Here you build an error type that fits your own program, so callers can tell failures apart.2 min readResult, the ? operator, enums, and traits at a basic level. It also assumes you have seen a custom error enum that implements Display and Error.2 min readResult<T, E>, the ? operator, and how a custom error type implements Display, Error, and From. You should also know what a trait is at a conceptual level.2 min read? operator, Box<dyn Error>, and how Debug and Display differ. It shows how main can return a Result, so ? works at the top of your program.2 min readmap, and how Result and Option work. It shows how to turn many fallible operations into one outcome.2 min readmatch and if let work, and the basics of Option<T>. Here you will see how to look inside an Option without consuming it.2 min readDisplay, Error, and From, and that you use ? and Box<dyn Error>. It shows the two crates that remove most of that boilerplate. They are thiserror and anyhow.2 min readOption, Result, the ? operator, custom error enums, and how unwrap and expect panic. It gives you a way to decide which tool fits each failure in your own functions.2 min read