# 用 Rust 重读「解析，别验证」：类型系统帮你省掉运行时检查

> 原标题：Rusty thoughts on "Parse, don't validate"

- 来源：Hacker News 首页
- 发布时间：2026-09-27T08:59:59.000Z
- AX AI 日报：https://ai-daily.ax0x.ai/items/59233
- 原文：https://eli.thegreenplace.net/2026/rusty-thoughts-on-parse-dont-validate/

## 摘要

Eli Bendersky 用 Rust 重新解读 Alexis King 那篇经典文章「Parse, don't validate」。核心思路很简单：别在运行时反复检查数据是否合法，而是用类型把约束写死。比如用 NonEmpty 类型代替 Vec，保证列表不可能为空，这样调用 first() 时就不用再处理 Option。文章举了 POSIX 工具和...
