rust/src/libcollections
Manish Goregaokar d264ef2b11 Rollup merge of #22313 - japaric:iter, r=aturon
`IntoIterator` now has an extra associated item:

``` rust
trait IntoIterator {
    type Item;
    type IntoIter: Iterator<Self=Self::Item>;
}
```

This lets you bind the iterator \"`Item`\" directly when writing generic functions:

``` rust
// hypothetical change, not included in this PR
impl Extend<T> for Vec<T> {
    // you can now write
    fn extend<I>(&mut self, it: I) where I: IntoIterator<Item=T> { .. }
    // instead of
    fn extend<I: IntoIterator>(&mut self, it: I) where I::IntoIter: Iterator<Item=T> { .. }
}
```

The downside is that now you have to write an extra associated type in your `IntoIterator` implementations:

``` diff
 impl<T> IntoIterator for Vec<T> {
+    type Item = T;
     type IntoIter = IntoIter<T>;

     fn into_iter(self) -> IntoIter<T> { .. }
 }
```

Because this breaks all downstream implementations of `IntoIterator`, this is a [breaking-change]

---

r? @aturon
2015-02-17 06:23:40 +05:30
..
btree Rollup merge of #22313 - japaric:iter, r=aturon 2015-02-17 06:23:40 +05:30
bench.rs Test fixes and rebase conflicts 2015-02-11 15:05:39 -08:00
binary_heap.rs Rollup merge of #22313 - japaric:iter, r=aturon 2015-02-17 06:23:40 +05:30
bit.rs add an associated Item type to IntoIterator 2015-02-13 19:02:02 -05:00
dlist.rs Rollup merge of #22313 - japaric:iter, r=aturon 2015-02-17 06:23:40 +05:30
enum_set.rs add an associated Item type to IntoIterator 2015-02-13 19:02:02 -05:00
fmt.rs more int and cloned cleanup in collections 2015-02-13 14:12:51 -05:00
lib.rs Fix rollup (remove slicing_syntax) 2015-02-15 19:26:39 +05:30
macros.rs Don't use std:: paths in syntax extensions when compiling a #![no_std] crate 2015-02-07 10:49:57 -08:00
ring_buf.rs Rollup merge of #22313 - japaric:iter, r=aturon 2015-02-17 06:23:40 +05:30
slice.rs Auto merge of #22367 - Manishearth:rollup, r=steveklabnik 2015-02-16 00:46:43 +00:00
str.rs Rollup merge of #22253 - huonw:unstable-words, r=aturon 2015-02-17 06:23:35 +05:30
string.rs Rollup merge of #21969 - Gankro:collections-cleanup, r=alexcrichton 2015-02-06 16:21:09 +05:30
vec_map.rs add an associated Item type to IntoIterator 2015-02-13 19:02:02 -05:00
vec.rs Rollup merge of #22313 - japaric:iter, r=aturon 2015-02-17 06:23:40 +05:30