Skip to content

Commit cbf97c3

Browse files
committed
style guide: suggest manual links to constructors
1 parent c21fd9a commit cbf97c3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/doc/style/style/comments.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,20 @@ Use inner doc comments _only_ to document crates and file-level modules:
8585
//!
8686
//! The core library is a something something...
8787
```
88+
89+
### Explain context.
90+
91+
Rust doesn't have special constructors, only functions that return new
92+
instances. These aren't visible in the automatically generated documentation
93+
for a type, so you should specifically link to them:
94+
95+
``` rust
96+
/// An iterator that yields `None` forever after the underlying iterator
97+
/// yields `None` once.
98+
///
99+
/// These can be created through
100+
/// [`iter.fuse()`](trait.Iterator.html#method.fuse).
101+
pub struct Fuse<I> {
102+
// ...
103+
}
104+
```

0 commit comments

Comments
 (0)