Skip to content

Commit bd339ce

Browse files
committed
doc: Document the new #[doc(no_inline)] attribute
1 parent 8dad7f5 commit bd339ce

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/doc/rustdoc.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@ pub fn recalibrate() {
4141
# }
4242
~~~
4343

44+
Documentation can also be controlled via the `doc` attribute on items.
45+
46+
~~~
47+
#[doc = "
48+
Calculates the factorial of a number.
49+
50+
Given the input integer `n`, this function will calculate `n!` and return it.
51+
"]
52+
pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n)} }
53+
~~~
54+
55+
The `doc` attribute can also be used to control how rustdoc emits documentation
56+
in some cases.
57+
58+
```
59+
// Rustdoc will inline documentation of a `pub use` into this crate when the
60+
// `pub use` reaches across crates, but this behavior can also be disabled.
61+
#[doc(no_inline)]
62+
pub use std::option::Option;
63+
```
64+
4465
Doc comments are markdown, and are currently parsed with the
4566
[sundown][sundown] library. rustdoc does not yet do any fanciness such as
4667
referencing other items inline, like javadoc's `@see`. One exception to this

0 commit comments

Comments
 (0)