Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

Commit e976db8

Browse files
expand comments doc
1 parent 6cdc15b commit e976db8

File tree

1 file changed

+45
-5
lines changed

1 file changed

+45
-5
lines changed

style/comments.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,53 @@ Use line comments instead:
1414
pub fn spawn(f: proc():Send) { ... }
1515
```
1616

17-
### Style doc comments like sentences.
17+
## Doc comments
1818

19-
Doc comments should begin with capital letters and end in a period,
20-
even in the short summary description. Prefer full sentences to
21-
fragments.
19+
Doc comments are prefixed by three slashes (`///`) and indicate
20+
documentation that you would like to be included in Rustdoc's output.
21+
They support
22+
[Markdown syntax](http://daringfireball.net/projects/markdown/)
23+
and are the main way of documenting your public APIs.
2224

23-
> **[FIXME]** Example.
25+
### Summary line
26+
27+
The first line in any doc comment should be a single-line short sentence
28+
providing a summary of the code. This line is used as a short summary
29+
description throughout Rustdoc's output, so it's a good idea to keep it
30+
short.
31+
32+
### Sentence structure
33+
34+
All doc comments, including the summary line, should begin with a
35+
capital letter and ending with a period, question mark, or exclamation
36+
point. Prefer full sentences to fragments.
37+
38+
For example:
39+
40+
``` rust
41+
/// Set up a default runtime configuration, given compiler-supplied arguments.
42+
///
43+
/// This function will block until the entire pool of M:N schedulers have
44+
/// exited. This function also requires a local task to be available.
45+
///
46+
/// # Arguments
47+
///
48+
/// * `argc` & `argv` - The argument vector. On Unix this information is used
49+
/// by os::args.
50+
/// * `main` - The initial procedure to run inside of the M:N scheduling pool.
51+
/// Once this procedure exits, the scheduling pool will begin to shut
52+
/// down. The entire pool (and this function) will only return once
53+
/// all child tasks have finished executing.
54+
///
55+
/// # Return value
56+
///
57+
/// The return value is used as the process return code. 0 on success, 101 on
58+
/// error.
59+
```
60+
61+
### Code snippets
62+
63+
> **[OPEN]**
2464
2565
### Avoid inner doc comments.
2666

0 commit comments

Comments
 (0)