mozilla/rust — pull request #6560 by gifnksm (2013-05-17 15:29:02+00:00)
Title: Add Iterator util methods/traits

This pull request adds following methods and traits.
```rust
pub trait IteratorUtil {
(snip)
fn filter_map<'r, B>(self, f: &'r fn(A) -> Option) -> FilterMapIterator<'r, A, B, Self>;
(snip)
fn to_vec(self) -> ~[A];
fn nth(&mut self, n: uint) -> A;
fn first(&mut self) -> A;
fn last(&mut self) -> A;
fn fold(&mut self, start: B, f: &fn(B, A) -> B) -> B;
fn count(&mut self) -> uint;
fn all(&mut self, f: &fn(&A) -> bool) -> bool;
fn any(&mut self, f: &fn(&A) -> bool) -> bool;
}

pub trait AdditiveIterator {
fn sum(&mut self) -> A;
}

pub trait MultiplicativeIterator {
fn product(&mut self) -> A;
}

pub trait OrdIterator {
fn max(&mut self) -> Option;
fn min(&mut self) -> Option;
}
```