]> git.proxmox.com Git - rustc.git/blob - src/doc/book/redirects/associated-types.md
New upstream version 1.25.0+dfsg1
[rustc.git] / src / doc / book / redirects / associated-types.md
1 % Associated Types
2
3 <small>There is a new edition of the book and this is an old link.</small>
4
5 > Associated types are a way of associating a type placeholder with a trait such that the trait method definitions can use these placeholder types in their signatures.
6
7 ```rust
8 pub trait Iterator {
9 type Item;
10 fn next(&mut self) -> Option<Self::Item>;
11 }
12 ```
13
14 ---
15
16 Here are the relevant sections in the new and old books:
17
18 * **[In the second edition: Ch 19.03 — Advanced Traits][2]**
19 * <small>[In the first edition: Ch 3.30 — Associated Types][1]</small>
20
21
22 [1]: first-edition/associated-types.html
23 [2]: second-edition/ch19-03-advanced-traits.html#associated-types-specify-placeholder-types-in-trait-definitions