Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust 1.94(2026-03)

官方发布说明:Announcing Rust 1.94.0

切片新增 array_windows,返回固定长度的数组引用,避免手动索引和运行时边界检查:

#![allow(unused)]
fn main() {
fn has_abba(input: &str) -> bool {
    input.as_bytes().array_windows()
        .any(|[a, b, b2, a2]| a != b && a == a2 && b == b2)
}
}

Cargo 配置支持 include,可以把团队共用配置拆分到多个 .toml 文件;同时支持 TOML 1.1 语法。发布库时要留意 Cargo.toml 的最低 Cargo 版本要求。