about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-24 11:56:16 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-25 01:18:37 -0700
commitbd339ced3615c89d439b33f6d6ab7bd04c002f74 (patch)
tree539ad5c26e567c2b9b5b4bce20e25432446d27f7
parent8dad7f579e029fd883d64848f4abb12630dcc3e6 (diff)
downloadrust-bd339ced3615c89d439b33f6d6ab7bd04c002f74.tar.gz
rust-bd339ced3615c89d439b33f6d6ab7bd04c002f74.zip
doc: Document the new #[doc(no_inline)] attribute
-rw-r--r--src/doc/rustdoc.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/doc/rustdoc.md b/src/doc/rustdoc.md
index 3880503c8e5..625a7a6d802 100644
--- a/src/doc/rustdoc.md
+++ b/src/doc/rustdoc.md
@@ -41,6 +41,27 @@ pub fn recalibrate() {
 # }
 ~~~
 
+Documentation can also be controlled via the `doc` attribute on items.
+
+~~~
+#[doc = "
+Calculates the factorial of a number.
+
+Given the input integer `n`, this function will calculate `n!` and return it.
+"]
+pub fn factorial(n: int) -> int { if n < 2 {1} else {n * factorial(n)} }
+~~~
+
+The `doc` attribute can also be used to control how rustdoc emits documentation
+in some cases.
+
+```
+// Rustdoc will inline documentation of a `pub use` into this crate when the
+// `pub use` reaches across crates, but this behavior can also be disabled.
+#[doc(no_inline)]
+pub use std::option::Option;
+```
+
 Doc comments are markdown, and are currently parsed with the
 [sundown][sundown] library. rustdoc does not yet do any fanciness such as
 referencing other items inline, like javadoc's `@see`. One exception to this