]> git.lizzy.rs Git - rust.git/commitdiff
Add missing associated type Item to Iterator
authorportal <portalorange2@gmail.com>
Mon, 20 Mar 2017 21:29:04 +0000 (23:29 +0200)
committerGitHub <noreply@github.com>
Mon, 20 Mar 2017 21:29:04 +0000 (23:29 +0200)
src/doc/unstable-book/src/conservative-impl-trait.md

index 62a7f8c16a0a71d5c09b64883d6191fe42e1bf15..0be6a321103f0858b9e0d70981b6a6414e72a47c 100644 (file)
@@ -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