Skip to content

Commit 531bdd7

Browse files
authored
Merge pull request #7 from mengfansheng-git/master
Chinese part command-line-arguments.md
2 parents 88f412a + 9ec8a5a commit 531bdd7

File tree

1 file changed

+43
-52
lines changed

1 file changed

+43
-52
lines changed

src/command-line-arguments.md

+43-52
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,31 @@ $ rustdoc --help
1717

1818
## `-V`/`--version`: version information
1919

20-
Using this flag looks like this:
20+
使用该flag的方式如下:
2121

2222
```bash
2323
$ rustdoc -V
2424
$ rustdoc --version
2525
```
2626

27-
This will show `rustdoc`'s version, which will look something
28-
like this:
27+
这将显示 `rustdoc` 的版本,如下所示:
2928

3029
```text
3130
rustdoc 1.17.0 (56124baa9 2017-04-24)
3231
```
3332

3433
## `-v`/`--verbose`: more verbose output
3534

36-
Using this flag looks like this:
35+
使用该flag的方式如下:
3736

3837
```bash
3938
$ rustdoc -v src/lib.rs
4039
$ rustdoc --verbose src/lib.rs
4140
```
4241

43-
This enables "verbose mode", which means that more information will be written
44-
to standard out. What is written depends on the other flags you've passed in.
45-
For example, with `--version`:
42+
这将启用 "冗长模式",即会将更多信息写入标准输出。
43+
写入的内容取决于你传入的其它标志。
44+
例如,使用 `--version`
4645

4746
```text
4847
$ rustdoc --verbose --version
@@ -57,38 +56,36 @@ LLVM version: 3.9
5756

5857
## `-o`/`--out-dir`: output directory path
5958

60-
Using this flag looks like this:
59+
使用该flag的方式如下:
6160

6261
```bash
6362
$ rustdoc src/lib.rs -o target/doc
6463
$ rustdoc src/lib.rs --out-dir target/doc
6564
```
6665

67-
By default, `rustdoc`'s output appears in a directory named `doc` in
68-
the current working directory. With this flag, it will place all output
69-
into the directory you specify.
66+
默认情况下,`rustdoc` 的输出会出现在当前工作目录下名为 `doc` 的目录中。
67+
使用此标记后,它将把所有输出到你指定的目录。
7068

7169
## `--crate-name`: controlling the name of the crate
7270

73-
Using this flag looks like this:
71+
使用该flag的方式如下:
7472

7573
```bash
7674
$ rustdoc src/lib.rs --crate-name mycrate
7775
```
7876

79-
By default, `rustdoc` assumes that the name of your crate is the same name
80-
as the `.rs` file. `--crate-name` lets you override this assumption with
81-
whatever name you choose.
77+
默认情况下,"rustdoc"会假定你的 crate 名称与".rs "文件相同。
78+
您可以使用 `--crate-name` 来覆盖这一假设。
8279

8380
## `--document-private-items`: Show items that are not public
8481

85-
Using this flag looks like this:
82+
使用该flag的方式如下:
8683

8784
```bash
8885
$ rustdoc src/lib.rs --document-private-items
8986
```
9087

91-
By default, `rustdoc` only documents items that are publicly reachable.
88+
默认情况下,`rustdoc` 只记录可公开访问的项目。
9289

9390
```rust
9491
pub fn public() {} // this item is public and will be documented
@@ -101,47 +98,44 @@ mod private { // this item is private and will not be documented
10198

10299
## `-L`/`--library-path`: where to look for dependencies
103100

104-
Using this flag looks like this:
101+
使用该flag的方式如下:
105102

106103
```bash
107104
$ rustdoc src/lib.rs -L target/debug/deps
108105
$ rustdoc src/lib.rs --library-path target/debug/deps
109106
```
110107

111-
If your crate has dependencies, `rustdoc` needs to know where to find them.
112-
Passing `--library-path` gives `rustdoc` a list of places to look for these
113-
dependencies.
108+
如果你的 crate 有依赖库,`rustdoc` 需要知道在哪里可以找到它们。
109+
传递 `--library-path` 会给 `rustdoc` 提供一个查找这些依赖项的列表。
114110

115-
This flag takes any number of directories as its argument, and will use all of
116-
them when searching.
111+
这个标志可以接受任意数量的目录作为参数,并在搜索时使用所有的目录。
117112

118113
## `--cfg`: passing configuration flags
119114

120-
Using this flag looks like this:
115+
使用该flag的方式如下:
121116

122117
```bash
123118
$ rustdoc src/lib.rs --cfg feature="foo"
124119
```
125120

126-
This flag accepts the same values as `rustc --cfg`, and uses it to configure
127-
compilation. The example above uses `feature`, but any of the `cfg` values
128-
are acceptable.
121+
该flag接受与 `rustc --cfg` 相同的值,并用它来配置编译。
122+
上面的例子使用了 `feature`,但任何 `cfg` 值都可以接受。
129123

130124
## `--extern`: specify a dependency's location
131125

132-
Using this flag looks like this:
126+
使用该flag的方式如下:
133127

134128
```bash
135129
$ rustdoc src/lib.rs --extern lazy-static=/path/to/lazy-static
136130
```
137131

138-
Similar to `--library-path`, `--extern` is about specifying the location
139-
of a dependency. `--library-path` provides directories to search in, `--extern`
140-
instead lets you specify exactly which dependency is located where.
132+
与"--library-path "类似,"--extern "是关于指定的位置。
133+
library-path "提供了搜索目录,而"--extern则可以让你精
134+
确地指定依赖项的位置。
141135

142136
## `-C`/`--codegen`: pass codegen options to rustc
143137

144-
Using this flag looks like this:
138+
使用该flag的方式如下:
145139

146140
```bash
147141
$ rustdoc src/lib.rs -C target_feature=+avx
@@ -154,54 +148,51 @@ $ rustdoc --test README.md -C target_feature=+avx
154148
$ rustdoc --test README.md --codegen target_feature=+avx
155149
```
156150

157-
When rustdoc generates documentation, looks for documentation tests, or executes documentation
158-
tests, it needs to compile some rust code, at least part-way. This flag allows you to tell rustdoc
159-
to provide some extra codegen options to rustc when it runs these compilations. Most of the time,
160-
these options won't affect a regular documentation run, but if something depends on target features
161-
to be enabled, or documentation tests need to use some additional options, this flag allows you to
162-
affect that.
151+
当 rustdoc 生成文档、查找文档测试或执行文档测试时,它需要编译一些 rust 代码,至少是部分编译。
152+
测试时,需要编译一些 rust 代码,至少是部分编译。这个flag允许你告诉 rustdoc
153+
在运行这些编译时向 rustc 提供一些额外的 codegen 选项。
154+
大多数情况下这些选项不会影响正常的文档运行,但如果某些内容依赖于目标特性
155+
或者文档测试需要使用一些额外的选项,这个flag允许你影响。
163156

164-
The arguments to this flag are the same as those for the `-C` flag on rustc. Run `rustc -C help` to
165-
get the full list.
157+
该标志的参数与 rustc 的 `-C` 标志相同。运行 `rustc -C help`
158+
获得完整的列表。
166159

167160
## `--test`: run code examples as tests
168161

169-
Using this flag looks like this:
162+
使用该flag的方式如下:
170163

171164
```bash
172165
$ rustdoc src/lib.rs --test
173166
```
174167

175-
This flag will run your code examples as tests. For more, see [the chapter
176-
on documentation tests](documentation-tests.md).
168+
该flag将把你的代码示例作为测试运行。更多信息,请参阅(document-tests.md)。
177169

178-
See also `--test-args`.
170+
另请参阅 `--test-args`
179171

180172
## `--test-args`: pass options to test runner
181173

182-
Using this flag looks like this:
174+
使用该flag的方式如下:
183175

184176
```bash
185177
$ rustdoc src/lib.rs --test --test-args ignored
186178
```
187179

188-
This flag will pass options to the test runner when running documentation tests.
189-
For more, see [the chapter on documentation tests](documentation-tests.md).
180+
运行文档测试时,该flag将向测试运行器传递选项。
181+
更多信息,请参阅(document-tests.md)
190182

191-
See also `--test`.
183+
另请参阅 `--test`
192184

193185
## `--target`: generate documentation for the specified target triple
194186

195-
Using this flag looks like this:
187+
使用该flag的方式如下:
196188

197189
```bash
198190
$ rustdoc src/lib.rs --target x86_64-pc-windows-gnu
199191
```
200192

201-
Similar to the `--target` flag for `rustc`, this generates documentation
202-
for a target triple that's different than your host triple.
193+
`rustc``--target` 标志类似,它会为与主机三元组不同的目标三元组生成文档。
203194

204-
All of the usual caveats of cross-compiling code apply.
195+
交叉编译代码的所有常见注意事项均适用。
205196

206197
## `--default-theme`: set the default theme
207198

0 commit comments

Comments
 (0)