File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Use `cargo test` to run all tests (including documentation tests), and `cargo te
6
6
7
7
These commands will appropriately invoke ` rustdoc ` (and ` rustc ` ) as required.
8
8
9
- ### Doc comments
9
+ ## Doc comments
10
10
11
11
Doc comments are very useful for big projects that require documentation. When
12
12
running Rustdoc, these are the comments that get compiled into
@@ -65,6 +65,43 @@ $ rustc doc.rs --crate-type lib
65
65
$ rustdoc --test --extern doc=" libdoc.rlib" doc.rs
66
66
```
67
67
68
+ ## Doc attributes
69
+
70
+ Below are a few examples of the most common ` #[doc] ` attributes used with ` rustdoc ` .
71
+
72
+ ### ` inline `
73
+
74
+ Used to inline docs, instead of linking out to separate page.
75
+
76
+ ``` rust
77
+ #[doc(inline)]
78
+ pub use bar :: Bar ;
79
+
80
+ /// bar docs
81
+ mod bar {
82
+ /// the docs for Bar
83
+ pub struct Bar ;
84
+ }
85
+ ```
86
+
87
+ ### ` no_inline `
88
+ Used to prevent linking out to separate page or anywhere.
89
+
90
+ ``` rust
91
+ // Example from libcore/prelude
92
+ #[doc(no_inline)]
93
+ pub use crate :: mem :: drop;
94
+ ```
95
+
96
+ ### ` hidden `
97
+
98
+ Using this tells ` rustdoc ` not to include this in documentation:
99
+ ``` rust,editable
100
+ // Example from the futures-rs library
101
+ #[doc(hidden)]
102
+ pub use self::async_await::*;
103
+ ```
104
+
68
105
### See also:
69
106
70
107
* [ The Rust Book: Making Useful Documentation Comments] [ book ]
You can’t perform that action at this time.
0 commit comments