RepoRust_RustErrorHandling.html
copyright © James Fawcett
Revised: 11/13/2025
Contents:
Demos for Rust error handling:
Rust has a rich set of error handling operations built into the language. This repository contains
demonstration code for those operations.
-
RustPanics
demonstrates when panics occur and how to trap them
-
ErrorHandlingOps
demonstrates quering returned results with is_ok, match, let if, ?
-
ConsoleErrorHandling
handling errors with stdin and stdout
-
FileErrorHandling
handling file open and read/write errors
-
IndexOutOfBounds
demonstrates that Rust out of bounds index results in panic
-
CppUndefinedBehavior
Illustrates that C++ allows mutation of data with active references and indexing out of bounds,
both resulting in undefined behavior. Also shows that C++ provides conventions to avoid undefined behavior.
Build:
This Rust code was built with Cargo from Visual Studio Code terminal and tested on Windows 10.
Status:
No planned changes.