Skip to content

Commit 23a1da4

Browse files
talk about doc(spotlight)
1 parent 0f96e14 commit 23a1da4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/doc/rustdoc/src/unstable-features.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,23 @@ a feature gate. For more information, see [its chapter in the Unstable Book][uns
128128

129129
[unstable-doc-cfg]: ../unstable-book/language-features/doc-cfg.html
130130
[issue-doc-cfg]: https://github.com/rust-lang/rust/issues/43781
131+
132+
## Adding your trait to the "Important Traits" dialog
133+
134+
Rustdoc keeps a list of a few traits that are believed to be "fundamental" to a given type when
135+
implemented on it. These traits are intended to be the primary interface for their types, and are
136+
often the only thing available to be documented on their types. For this reason, Rustdoc will track
137+
when a given type implements one of these traits and call special attention to it when a function
138+
returns one of these types. This is the "Important Traits" dialog, visible as a circle-i button next
139+
to the function, which, when clicked, shows the dialog.
140+
141+
In the standard library, the traits that qualify for inclusion are `Iterator`, `io::Read`, and
142+
`io::Write`. However, rather than being implemented as a hard-coded list, these traits have a
143+
special marker attribute on them: `#[doc(spotlight)]`. This means that you could apply this
144+
attribute to your own trait to include it in the "Important Traits" dialog in documentation.
145+
146+
The `#[doc(spotlight)]` attribute is controlled by a feature gate. For more information, see [its
147+
chapter in the Unstable Book][unstable-spotlight] and [its tracking issue][issue-spotlight].
148+
149+
[unstable-spotlight]: ../unstable-book/language-features/doc-spotlight.html
150+
[issue-spotlight]: https://github.com/rust-lang/rust/issues/45040

0 commit comments

Comments
 (0)