Skip to Content
Rust for Rustaceans
book

Rust for Rustaceans

by Jon Gjengset
December 2021
Intermediate to advanced
280 pages
8h 43m
English
No Starch Press
Content preview from Rust for Rustaceans

4 Error Handling

For all but the simplest programs, you will have methods that can fail. In this chapter, we’ll look at different ways to represent, handle, and propagate those failures and the advantages and drawbacks of each. We’ll start by exploring different ways to represent errors, including enumeration and erasure, and then examine some special error cases that require a different representation technique. Next, we’ll look at various ways of handling errors and the future of error handling.

It’s worth noting that best practices for error handling in Rust are still an active topic of conversation, and at the time of writing, the ecosystem ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Rust in Action

Rust in Action

Tim McNamara
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols
Effective Rust

Effective Rust

David Drysdale
Command-Line Rust

Command-Line Rust

Ken Youens-Clark

Publisher Resources

ISBN: 9781098129828