# Revisiting spotlight / "notable traits" in rustdoc

**URL:** <https://internals.rust-lang.org/t/revisiting-spotlight-notable-traits-in-rustdoc/14759>\
**Category:** tools and infrastructure\
**Created:** [May 23, 2021, 1:08am UTC](https://internals.rust-lang.org/t/revisiting-spotlight-notable-traits-in-rustdoc/14759 "2021-05-23T01:08:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![SkiFire13](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/skifire13/32/7579_2.png) [@SkiFire13](https://internals.rust-lang.org/u/SkiFire13)\
**Post date:** [May 23, 2021, 9:10am UTC](https://internals.rust-lang.org/t/revisiting-spotlight-notable-traits-in-rustdoc/14759/4 "2021-05-23T09:10:01Z")

</div>

> [@jsha](#):
>
> ![image](https://us1.discourse-cdn.com/flex002/uploads/rustlang/original/2X/e/e6abb722f442670cb1def50c22c464729baa91de.png)

This looks nice, but I would change the works. Instead of "an Iterator of &T", which doesn't work for all types, I would use something like "`impl Iterator<Item = &'a T>`", possibly using the same `'a` and `T` as the `impl` block/fn generics that are used.

For example if we had:

```rust
impl<'a, T> Iterator for Iter<'a, T> {
    type Item = &'a T;
    // ...
}

impl<U> [U] {
    pub fn iter(&self) -> Iter<'_, U> { /* ... */ }
}

```

Then in the docs, on the right of the function signature, there would be written "`impl Iterator<Item = &'_ U>`".

Possible downsides:

- This may create confusion with lifetimes, in particular elided lifetimes
- If the type of `Item` (or other types present in the trait implementation) are pretty long this could easily get out of control.
- How do you show multiple notable traits? Think for example of types that implement both `Read` and `BufRead`, or `Iterator` and `FusedIterator`

It would also be nice to have a way to restrict/select notable traits. For example in the docs of `Iterator::by_ref` I don't care that the returned reference may implement `Read`, I only care about `Iterator`.

---

_[View the full topic](https://internals.rust-lang.org/t/revisiting-spotlight-notable-traits-in-rustdoc/14759)._
