这是用户在 2024-3-13 17:52 为 https://doc.rust-lang.org/book/foreword.html 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Foreword 前言

It wasn’t always so clear, but the Rust programming language is fundamentally about empowerment: no matter what kind of code you are writing now, Rust empowers you to reach farther, to program with confidence in a wider variety of domains than you did before.
它并不总是那么清楚,但 Rust 编程语言从根本上讲是关于授权的:无论你现在写什么样的代码,Rust 都让你能够走得更远,在比以前更广泛的领域自信地编程。

Take, for example, “systems-level” work that deals with low-level details of memory management, data representation, and concurrency. Traditionally, this realm of programming is seen as arcane, accessible only to a select few who have devoted the necessary years learning to avoid its infamous pitfalls. And even those who practice it do so with caution, lest their code be open to exploits, crashes, or corruption.
以“系统级”工作为例,它处理内存管理、数据表示和并发的低级细节。传统上,这个编程领域被认为是神秘的,只有少数人可以进入,他们已经投入了必要的数年学习以避免其臭名昭著的陷阱。即使是那些实践它的人也要谨慎行事,以免他们的代码被利用、崩溃或损坏。

Rust breaks down these barriers by eliminating the old pitfalls and providing a friendly, polished set of tools to help you along the way. Programmers who need to “dip down” into lower-level control can do so with Rust, without taking on the customary risk of crashes or security holes, and without having to learn the fine points of a fickle toolchain. Better yet, the language is designed to guide you naturally towards reliable code that is efficient in terms of speed and memory usage.
Rust 通过消除旧的陷阱并提供一套友好、完善的工具来帮助您,从而打破了这些障碍。需要“深入”到较低级别的控制中的程序员可以使用 Rust 来做到这一点,而无需承担崩溃或安全漏洞的惯常风险,也不必学习变化无常的工具链的细节。更好的是,该语言旨在自然地引导您获得在速度和内存使用方面高效的可靠代码。

Programmers who are already working with low-level code can use Rust to raise their ambitions. For example, introducing parallelism in Rust is a relatively low-risk operation: the compiler will catch the classical mistakes for you. And you can tackle more aggressive optimizations in your code with the confidence that you won’t accidentally introduce crashes or vulnerabilities.
已经使用低级代码的程序员可以使用 Rust 来提高他们的雄心壮志。例如,在 Rust 中引入并行性是一个风险相对较低的操作:编译器会为你捕获经典错误。而且,您可以在代码中处理更积极的优化,并确信不会意外引入崩溃或漏洞。

But Rust isn’t limited to low-level systems programming. It’s expressive and ergonomic enough to make CLI apps, web servers, and many other kinds of code quite pleasant to write — you’ll find simple examples of both later in the book. Working with Rust allows you to build skills that transfer from one domain to another; you can learn Rust by writing a web app, then apply those same skills to target your Raspberry Pi.
但 Rust 并不局限于低级系统编程。它的表现力和人体工程学足以使 CLI 应用程序、Web 服务器和许多其他类型的代码编写起来非常愉快——您将在本书后面找到两者的简单示例。使用 Rust 可以让你培养从一个领域转移到另一个领域的技能;你可以通过编写一个 Web 应用程序来学习 Rust,然后应用这些相同的技能来定位你的 Raspberry Pi。

This book fully embraces the potential of Rust to empower its users. It’s a friendly and approachable text intended to help you level up not just your knowledge of Rust, but also your reach and confidence as a programmer in general. So dive in, get ready to learn—and welcome to the Rust community!
本书充分展现了 Rust 赋予用户权力的潜力。这是一本友好且平易近人的文本,旨在帮助您提升对 Rust 的了解,以及您作为程序员的影响力和信心。所以,潜入其中,准备好学习——欢迎来到 Rust 社区!

— Nicholas Matsakis and Aaron Turon
— 尼古拉斯·马萨基斯和亚伦·图伦