diff options
| author | QuietMisdreavus <grey@quietmisdreavus.net> | 2017-10-04 22:00:22 -0500 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2017-11-17 22:50:15 +0100 |
| commit | 831fd783416d9f87ec9308ed56e891d0b1ffdbcd (patch) | |
| tree | fba456f839de14c0fc114beced70cf55a531f0e8 /src/doc | |
| parent | cbe4ac30797f9e994b3ae275e3edf12b2d450800 (diff) | |
| download | rust-831fd783416d9f87ec9308ed56e891d0b1ffdbcd.tar.gz rust-831fd783416d9f87ec9308ed56e891d0b1ffdbcd.zip | |
add doc_highlight feature flag and tests
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/doc-spotlight.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/doc-spotlight.md b/src/doc/unstable-book/src/language-features/doc-spotlight.md new file mode 100644 index 00000000000..8aca01bb638 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/doc-spotlight.md @@ -0,0 +1,27 @@ +# `doc_spotlight` + +The tracking issue for this feature is: [TODO] + +The `doc_spotlight` feature allows the use of the `spotlight` parameter to the `#[doc]` attribute, +to "spotlight" a specific trait on the return values of functions. Adding a `#[doc(spotlight)]` +attribute to a trait definition will make rustdoc print extra information for functions which return +a type that implements that trait. This attribute is applied to the `Iterator`, `io::Read`, and +`io::Write` traits in the standard library. + +You can do this on your own traits, like this: + +``` +#![feature(doc_spotlight)] + +#[doc(spotlight)] +pub trait MyTrait {} + +pub struct MyStruct; +impl MyTrait for MyStruct {} + +/// The docs for this function will have an extra line about `MyStruct` implementing `MyTrait`, +/// without having to write that yourself! +pub fn my_fn() -> MyStruct { MyStruct } +``` + +This feature was originally implemented in PR [TODO]. |
