2.3 数组迭代
03-数组迭代 — Comprehensive Rust
1分钟内可阅读完
译文 · 基于 Comprehensive Rust
原文链接: https://google.github.io/comprehensive-rust/tuples-and-arrays/iteration.html
2.3 数组迭代
for 语句支持遍历数组(但不支持元组)。
| |
该功能依赖
IntoIteratortrait,但我们尚未讲到。这里首次出现
assert_ne!宏。还有assert_eq!与assert!。这些宏总会检查;而debug_assert!等仅调试版变体在 release 构建中会编译为空操作。