Skip to content

Commit

Permalink
Merge pull request #1887 from Flamenco/patch-1
Browse files Browse the repository at this point in the history
Clarify that the associated type is also required by the Iterator trait
  • Loading branch information
marioidival authored Sep 30, 2024
2 parents 6e0146a + c7305e6 commit 4dafcae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/trait/iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct Fibonacci {
}
// Implement `Iterator` for `Fibonacci`.
// The `Iterator` trait only requires a method to be defined for the `next` element.
// The `Iterator` trait only requires a method to be defined for the `next` element,
// and an `associated type` to declare the return type of the iterator.
impl Iterator for Fibonacci {
// We can refer to this type using Self::Item
type Item = u32;
Expand Down

0 comments on commit 4dafcae

Please sign in to comment.