diff options
| author | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-28 17:20:27 +0200 |
|---|---|---|
| committer | Alexis Bourget <alexis.bourget@gmail.com> | 2020-06-28 17:20:27 +0200 |
| commit | e611a3fb8423f178e856813fc1a1f2397980bd8a (patch) | |
| tree | 27851f412dd166128e83f919059aafdd2c07e707 | |
| parent | 3fc5593ea80819f940f6edef3108d15ef2ad7956 (diff) | |
| download | rust-e611a3fb8423f178e856813fc1a1f2397980bd8a.tar.gz rust-e611a3fb8423f178e856813fc1a1f2397980bd8a.zip | |
Apply suggestions from code review
| -rw-r--r-- | src/libstd/keyword_docs.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs index 3b493c4244d..089056d68f8 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -1479,17 +1479,28 @@ mod true_keyword {} /// assert_eq!(m, k); /// ``` /// -/// In traits, using `type` allows the usage of an associated type without -/// knowing about it when declaring the [`trait`]: +/// In traits, `type` is used to declare an [associated type]: /// /// ```rust /// trait Iterator { +/// // associated type declaration /// type Item; /// fn next(&mut self) -> Option<Self::Item>; /// } +/// +/// struct Once<T>(Option<T>); +/// +/// impl<T> Iterator for Once<T> { +/// // associated type definition +/// type Item = T; +/// fn next(&mut self) -> Option<Self::Item> { +/// self.0.take() +/// } +/// } /// ``` /// /// [`trait`]: keyword.trait.html +/// [associated type]: ../reference/items/associated-items.html#associated-types mod type_keyword {} #[doc(keyword = "unsafe")] |
