|
1.
|
|
|
% Rust Documentation
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/index.md:2 src/doc/rustdoc.md:2
|
|
2.
|
|
|
`rustdoc` is the built-in tool for generating documentation. It integrates with the compiler to provide accurate hyperlinking between usage of types and their documentation. Furthermore, by not using a separate parser, it will never reject your valid Rust code.
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:7
|
|
3.
|
|
|
# Creating Documentation
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:9
|
|
4.
|
|
|
Documenting Rust APIs is quite simple. To document a given item, we have "doc comments":
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:12
|
|
5.
|
|
|
~~~ # #![allow(unused_attribute)] // the "link" crate attribute is currently required for rustdoc, but normally // isn't needed. #![crate_id = "universe"] #![crate_type="lib"]
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:19
|
|
6.
|
|
|
//! Tools for dealing with universes (this is a doc comment, and is shown on //! the crate index page. The ! makes it apply to the parent of the comment, //! rather than what follows).
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:23
|
|
7.
|
|
|
# mod workaround_the_outer_function_rustdoc_inserts {
/// Widgets are very common (this is a doc comment, and will show up on
/// Widget's documentation).
pub struct Widget {
[tab] /// All widgets have a purpose (this is a doc comment, and will show up
[tab] /// the field's documentation).
[tab] purpose: String,
[tab] /// Humans are not allowed to understand some widgets
[tab] understandable: bool
}
|
|
|
type: Plain text
|
|
|
[tab] represents a tab character.
Please write it exactly the same way, [tab] , in your
translation.
|
|
|
represents a line break.
Start a new line in the equivalent position in the translation.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:34
|
|
8.
|
|
|
pub fn recalibrate() {
[tab] //! Recalibrate a pesky universe (this is also a doc comment, like above,
[tab] //! the documentation will be applied to the *parent* item, so
[tab] //! `recalibrate`).
[tab] /* ... */
}
# }
~~~
|
|
|
type: Plain text
|
|
|
[tab] represents a tab character.
Please write it exactly the same way, [tab] , in your
translation.
|
|
|
represents a line break.
Start a new line in the equivalent position in the translation.
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:43
|
|
9.
|
|
|
Documentation can also be controlled via the `doc` attribute on items. This is implicitly done by the compiler when using the above form of doc comments (converting the slash-based comments to `#[doc]` attributes).
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:47
|
|
10.
|
|
|
~~~ #[doc = " Calculates the factorial of a number.
|
|
|
type: Plain text
|
|
|
|
(no translation yet)
|
|
|
|
Located in
src/doc/rustdoc.md:51
|