diff options
| author | portal <portalorange2@gmail.com> | 2017-03-20 23:29:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-20 23:29:04 +0200 |
| commit | 1a00c8fe0f2c5c20509a7337a5776386cb00f09b (patch) | |
| tree | e629f233b9ef52dcf682f3834f2c189aeb66cad3 | |
| parent | 134c4a0f08a3d1f55ea8968fbe728fa935c71698 (diff) | |
| download | rust-1a00c8fe0f2c5c20509a7337a5776386cb00f09b.tar.gz rust-1a00c8fe0f2c5c20509a7337a5776386cb00f09b.zip | |
Add missing associated type Item to Iterator
| -rw-r--r-- | src/doc/unstable-book/src/conservative-impl-trait.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/unstable-book/src/conservative-impl-trait.md b/src/doc/unstable-book/src/conservative-impl-trait.md index 62a7f8c16a0..0be6a321103 100644 --- a/src/doc/unstable-book/src/conservative-impl-trait.md +++ b/src/doc/unstable-book/src/conservative-impl-trait.md @@ -33,9 +33,9 @@ fn main() { In today's Rust, you can write function signatures like: ````rust,ignore -fn consume_iter_static<I: Iterator<u8>>(iter: I) { } +fn consume_iter_static<I: Iterator<Item=u8>>(iter: I) { } -fn consume_iter_dynamic(iter: Box<Iterator<u8>>) { } +fn consume_iter_dynamic(iter: Box<Iterator<Item=u8>>) { } ```` In both cases, the function does not depend on the exact type of the argument. @@ -50,13 +50,13 @@ The type held is "abstract", and is assumed only to satisfy a trait bound. On the other hand, while you can write: ````rust,ignore -fn produce_iter_dynamic() -> Box<Iterator<u8>> { } +fn produce_iter_dynamic() -> Box<Iterator<Item=u8>> { } ```` ...but you _cannot_ write something like: ````rust,ignore -fn produce_iter_static() -> Iterator<u8> { } +fn produce_iter_static() -> Iterator<Item=u8> { } ```` That is, in today's Rust, abstract return types can only be written using trait |
