Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 971 Bytes

File metadata and controls

28 lines (20 loc) · 971 Bytes

L3.6 — Rust error handling patterns for systems programming

Date: 2025-10-04

Author: Community Contributor (placeholder)

Estimated time

30–45 minutes

Objectives

  • Introduce common error handling patterns in Rust useful for low-level systems code.
  • Show examples using Result, Option, thiserror, and anyhow.
  • Discuss trade-offs when writing code intended for kernel or low-level contexts.

Prerequisites

  • Familiarity with basic Rust syntax and ownership (Module 3 content).

Content

  • Brief explanation of Result<T, E> and pattern matching.
  • Using ? for early returns and converting errors with From.
  • When to prefer thiserror vs anyhow in libraries vs binaries.

Exercises

  • Rewrite a small function to return Result instead of panicking.
  • Create a small enum of error types and implement From for conversions.

Contributor notes

Placeholder lesson — expand with code snippets and references to rust-lang docs.