1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! # Various living beings
//!
//! Flora and Fauna can be found here.
/// A human being
///
/// Warning: Humans have feelings!
///
/// You can document individual fields by using `///` doc comments.
/// But these doc-comments have to come *before* the field, not after it.
///
/// Wrong example:
///
/// ```
/// /// docstring for the entire struct
/// pub struct Human {
/// pub name: String, /// No, this is NOT where the documentation should go
/// pub age: usize, // because the above docstring would be linked to the age field
/// }
/// ```
///
/// Correct example:
/// ```
/// /// docstring for the entire struct
/// pub struct Human {
/// /// This is the right spot for documenting the name field
/// pub name: String,
/// /// and this is the docstring for the age field
/// pub age: usize,
/// }
/// ```
///
/// Now check out the actual source for this module, to see how it is done.
/// After that we want to look at [external examples](super::external).