@@ -17,32 +17,31 @@ $ rustdoc --help
17
17
18
18
## ` -V ` /` --version ` : version information
19
19
20
- Using this flag looks like this:
20
+ 使用该flag的方式如下:
21
21
22
22
``` bash
23
23
$ rustdoc -V
24
24
$ rustdoc --version
25
25
```
26
26
27
- This will show ` rustdoc ` 's version, which will look something
28
- like this:
27
+ 这将显示 ` rustdoc ` 的版本,如下所示:
29
28
30
29
``` text
31
30
rustdoc 1.17.0 (56124baa9 2017-04-24)
32
31
```
33
32
34
33
## ` -v ` /` --verbose ` : more verbose output
35
34
36
- Using this flag looks like this:
35
+ 使用该flag的方式如下:
37
36
38
37
``` bash
39
38
$ rustdoc -v src/lib.rs
40
39
$ rustdoc --verbose src/lib.rs
41
40
```
42
41
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 ` :
46
45
47
46
``` text
48
47
$ rustdoc --verbose --version
@@ -57,38 +56,36 @@ LLVM version: 3.9
57
56
58
57
## ` -o ` /` --out-dir ` : output directory path
59
58
60
- Using this flag looks like this:
59
+ 使用该flag的方式如下:
61
60
62
61
``` bash
63
62
$ rustdoc src/lib.rs -o target/doc
64
63
$ rustdoc src/lib.rs --out-dir target/doc
65
64
```
66
65
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
+ 使用此标记后,它将把所有输出到你指定的目录。
70
68
71
69
## ` --crate-name ` : controlling the name of the crate
72
70
73
- Using this flag looks like this:
71
+ 使用该flag的方式如下:
74
72
75
73
``` bash
76
74
$ rustdoc src/lib.rs --crate-name mycrate
77
75
```
78
76
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 ` 来覆盖这一假设。
82
79
83
80
## ` --document-private-items ` : Show items that are not public
84
81
85
- Using this flag looks like this:
82
+ 使用该flag的方式如下:
86
83
87
84
``` bash
88
85
$ rustdoc src/lib.rs --document-private-items
89
86
```
90
87
91
- By default, ` rustdoc ` only documents items that are publicly reachable.
88
+ 默认情况下, ` rustdoc ` 只记录可公开访问的项目。
92
89
93
90
``` rust
94
91
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
101
98
102
99
## ` -L ` /` --library-path ` : where to look for dependencies
103
100
104
- Using this flag looks like this:
101
+ 使用该flag的方式如下:
105
102
106
103
``` bash
107
104
$ rustdoc src/lib.rs -L target/debug/deps
108
105
$ rustdoc src/lib.rs --library-path target/debug/deps
109
106
```
110
107
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 ` 提供一个查找这些依赖项的列表。
114
110
115
- This flag takes any number of directories as its argument, and will use all of
116
- them when searching.
111
+ 这个标志可以接受任意数量的目录作为参数,并在搜索时使用所有的目录。
117
112
118
113
## ` --cfg ` : passing configuration flags
119
114
120
- Using this flag looks like this:
115
+ 使用该flag的方式如下:
121
116
122
117
``` bash
123
118
$ rustdoc src/lib.rs --cfg feature=" foo"
124
119
```
125
120
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 ` 值都可以接受。
129
123
130
124
## ` --extern ` : specify a dependency's location
131
125
132
- Using this flag looks like this:
126
+ 使用该flag的方式如下:
133
127
134
128
``` bash
135
129
$ rustdoc src/lib.rs --extern lazy-static=/path/to/lazy-static
136
130
```
137
131
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
+ 确地指定依赖项的位置。
141
135
142
136
## ` -C ` /` --codegen ` : pass codegen options to rustc
143
137
144
- Using this flag looks like this:
138
+ 使用该flag的方式如下:
145
139
146
140
``` bash
147
141
$ rustdoc src/lib.rs -C target_feature=+avx
@@ -154,54 +148,51 @@ $ rustdoc --test README.md -C target_feature=+avx
154
148
$ rustdoc --test README.md --codegen target_feature=+avx
155
149
```
156
150
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允许你影响。
163
156
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
+ 获得完整的列表。
166
159
167
160
## ` --test ` : run code examples as tests
168
161
169
- Using this flag looks like this:
162
+ 使用该flag的方式如下:
170
163
171
164
``` bash
172
165
$ rustdoc src/lib.rs --test
173
166
```
174
167
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)。
177
169
178
- See also ` --test-args ` .
170
+ 另请参阅 ` --test-args ` 。
179
171
180
172
## ` --test-args ` : pass options to test runner
181
173
182
- Using this flag looks like this:
174
+ 使用该flag的方式如下:
183
175
184
176
``` bash
185
177
$ rustdoc src/lib.rs --test --test-args ignored
186
178
```
187
179
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)。
190
182
191
- See also ` --test ` .
183
+ 另请参阅 ` --test ` 。
192
184
193
185
## ` --target ` : generate documentation for the specified target triple
194
186
195
- Using this flag looks like this:
187
+ 使用该flag的方式如下:
196
188
197
189
``` bash
198
190
$ rustdoc src/lib.rs --target x86_64-pc-windows-gnu
199
191
```
200
192
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 ` 标志类似,它会为与主机三元组不同的目标三元组生成文档。
203
194
204
- All of the usual caveats of cross-compiling code apply.
195
+ 交叉编译代码的所有常见注意事项均适用。
205
196
206
197
## ` --default-theme ` : set the default theme
207
198
0 commit comments