error-concept
Classify retryable errors
Classify failures for a particular operation. This example models a repeat-safe read, where interruption may warrant another attempt. The classification is application policy, not a universal mapping. Expected stdout (not executed): true false Expected stderr: (empty) Expected exit: success Common mistake: Retrying every error, including invalid data or denied permissions.
Formal Syntax & Structure
rust syntaxrust
match error.kind() { ErrorKind::Interrupted => ..., _ => ... }Working Example
Example Snippetrust
use std::io::ErrorKind;fn retryable(kind: ErrorKind) -> bool { matches!(kind, ErrorKind::Interrupted) }fn main() { for kind in [ErrorKind::Interrupted, ErrorKind::PermissionDenied] { println!("{}", retryable(kind)); }}