File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ pub fn recalibrate() {
41
41
# }
42
42
~~~
43
43
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
+
44
65
Doc comments are markdown, and are currently parsed with the
45
66
[ sundown] [ sundown ] library. rustdoc does not yet do any fanciness such as
46
67
referencing other items inline, like javadoc's ` @see ` . One exception to this
You can’t perform that action at this time.
0 commit comments