diff options
| author | Martin Pool <mbp@sourcefrog.net> | 2015-10-06 19:42:58 -0700 |
|---|---|---|
| committer | Martin Pool <mbp@sourcefrog.net> | 2015-10-06 19:42:58 -0700 |
| commit | cbf97c3e65e288702ccaea7f4a7153a37f7e4ee3 (patch) | |
| tree | 882bf4e73f09484ec20f91fc3fa4dff9fcbc715f | |
| parent | c21fd9a34f763c532ded7bf141b90a01cef76c43 (diff) | |
| download | rust-cbf97c3e65e288702ccaea7f4a7153a37f7e4ee3.tar.gz rust-cbf97c3e65e288702ccaea7f4a7153a37f7e4ee3.zip | |
style guide: suggest manual links to constructors
| -rw-r--r-- | src/doc/style/style/comments.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/doc/style/style/comments.md b/src/doc/style/style/comments.md index b2d2d9ab6b4..3851187b520 100644 --- a/src/doc/style/style/comments.md +++ b/src/doc/style/style/comments.md @@ -85,3 +85,20 @@ Use inner doc comments _only_ to document crates and file-level modules: //! //! The core library is a something something... ``` + +### Explain context. + +Rust doesn't have special constructors, only functions that return new +instances. These aren't visible in the automatically generated documentation +for a type, so you should specifically link to them: + +``` rust +/// An iterator that yields `None` forever after the underlying iterator +/// yields `None` once. +/// +/// These can be created through +/// [`iter.fuse()`](trait.Iterator.html#method.fuse). +pub struct Fuse<I> { + // ... +} +``` |
