This folder demonstrates handling recoverable errors in Rust, especially with file operations.
- Using
Resultandmatchfor error handling - Handling file open and creation errors
- Matching on error kinds (e.g., NotFound)
- Result<T, E>: Used for recoverable errors, allows handling different error cases
- ErrorKind: Enum for different types of I/O errors
- Graceful error handling and file creation
- Attempt to open a file, create if not found
- Match on error kind to handle specific cases
- Panic only for truly unrecoverable errors
- File not found or cannot be created
- Other I/O errors
cargo run
cargo checkSee src/main.rs for code examples and comments explaining each concept.