Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

non_exhaustive

An attribute that says more variants or fields may be added later, so adding them isn't a breaking change.

#[non_exhaustive] on an enum or struct forces other crates to include a wildcard arm when matching and forbids them from constructing the struct with a literal.

Examples

  • With #[non_exhaustive] pub enum Event { Watered, Alarm }, a match in another crate that lists both variants still fails with E0004 until it adds a _ => arm.

Read the full section →