Rust 程序设计语言 中文版——Chinese translation of The Rust Programming Language (Book)
Go to file
2021-05-09 17:51:02 +08:00
.github/workflows Add CI 2021-05-09 17:15:21 +08:00
ci Add CI 2021-05-09 17:15:21 +08:00
dot Add new files from the English repo 2021-05-09 14:49:31 +08:00
listings Add new files from the English repo 2021-05-09 14:49:31 +08:00
src Update words 2021-05-09 16:38:58 +08:00
theme Add theme and js files 2021-05-09 15:16:11 +08:00
tools Add CI 2021-05-09 17:15:21 +08:00
.gitignore Add a script that hooks the nostarch build commands together 2016-08-18 10:54:22 -04:00
book.toml Update words 2021-05-09 16:38:58 +08:00
Cargo.lock Add CI 2021-05-09 17:15:21 +08:00
Cargo.toml Add CI 2021-05-09 17:15:21 +08:00
CONTRIBUTING.md Update README.md and CONTRIBUTING.md 2017-02-05 20:38:51 +08:00
deploy.sh Add new files from the English repo 2021-05-09 14:49:31 +08:00
ferris.css Add theme and js files 2021-05-09 15:16:11 +08:00
ferris.js Add theme and js files 2021-05-09 15:16:11 +08:00
README.md Udpate README.md 2021-05-09 17:51:02 +08:00
rust-toolchain Add CI 2021-05-09 17:15:21 +08:00
rustfmt.toml Add CI 2021-05-09 17:15:21 +08:00
style-guide.md Update style-guide.md 2016-09-06 17:07:14 -04:00

Rust 程序设计语言

Build Status

Chinese translation of The Rust Programming Language
鉴于目前网上的中文版已经滞后英文内容,所以重新开启本书翻译,跟进原书。

可以从 No Starch Press 购买本书英文版

中文译版注:

  1. 中文出版书名为《Rust 权威指南》,可以在中文线上或线下购书平台购买。
  2. 出版的版本翻译独立于本仓库翻译。

在线上可以阅读中文版阅读英文版。另外英文版在线阅读可以选择 stablebetanightly 三个不同的分支版本,这几个分支版本可能滞后于[英文仓库]的最新内容。

依赖

构建这本书需要 mdBook 。执行以下命令安装:

$ cargo install mdbook

或指定安装版本:

$ cargo install mdbook --vers [version-num]

构建

构建此书,请输入:

$ mdbook build

输出内容存放在 book 子目录中。可使用浏览器打开来查看内容。

Firefox:

$ firefox book/index.html                       # Linux
$ open -a "Firefox" book/index.html             # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
$ start firefox.exe .\book\index.html           # Windows (Cmd)

Chrome:

$ google-chrome book/index.html                 # Linux
$ open -a "Google Chrome" book/index.html       # OS X
$ Start-Process "chrome.exe" .\book\index.html  # Windows (PowerShell)
$ start chrome.exe .\book\index.html            # Windows (Cmd)

To run the tests:

$ mdbook test

运行测试:

$ mdbook test

参与贡献

您的帮助,我们将感激不尽(We'd love your help)!请参见 CONTRIBUTING.md(英文原项目参与贡献指引 CONTRIBUTING-EN.md)。

Graphviz dot

译注Graphviz 是一种图形绘制工具,使用 dot 语言来编写绘制

这主要是给 Carol 参考的因为她不得不检查这些内容原文This is mostly for Carol's reference because she keeps having to look it up

我们使用 Graphviz 来绘制一些书中需要的图表。这些文件的源文件位于 dot 目录中。要将 dot 文件转换成 svg 文件,如转换 dot/trpl04-01.dot 文件,运行:

$ dot dot/trpl04-01.dot -Tsvg > src/img/trpl04-01.svg

在生成的 SVG 中,从 svg 元素中删除了宽度和高度属性,并将 viewBox 属性设置成 0.00 0.00 1000.00 1000.00 或其他不会截断图像的值。

拼写检查(仅对英文检查起作用)

要扫描源文件的拼写错误,可以使用 spellcheck.sh 脚本。这需要一个带有有效单词的字典文件,由 dictionary.txt 提供。如果脚本产生了一个假阳性(比如说,你使用了 BTreeMap 单词,但脚本认为无效),就需要将这个单词添加到 dictionary.txt 文件(保持排序的顺序以确保一致性)。

将 Windows 换行符转换为 Unix 的

这主要是给 Carol 参考因为她不得不检查不规范的换行符。原文This is mostly for Carol's reference because she keeps having to look it up.

$ tr -d '\015' < DOS-file > UNIX-file

翻译

我们很乐意翻译这本书!请参阅“翻译”标签(在英文原仓库)以加入当前正在进行的工作。新建一个 Issue开始使用新语言在我们合并任何内容之前我们正在等待 mdbook 对多种语言的支持,只要支持后将随时可以开始!

拼写检查

要扫描源文件是否存在拼写错误,可以使用 ci 目录中的脚本 spellcheck.sh。这需要一个有效词词典,该词典为 ci/dictionary.txt。如果脚本产生误报(例如,使用了词语 BTreeMap 被脚本认为无效),则需要在 ci/dictionary.txt 中添加该单词(保持排序顺序以保持一致性)。