I\'m not sure how to specify bounds on the type of the output of the iterator for generic iterators. Before Rust 1.0, I used to be able to do this:
fn somefu
You can introduce a second generic type parameter and place the bound on that:
fn somefunc<A: Int, I: Iterator<Item = A>>(mut xs: I) {
xs.next().unwrap().pow(2);
}
You can also place trait bounds on the associated type itself
fn somefunc<I: Iterator>(mut xs: I)
where
I::Item: Int,
{
xs.next().unwrap().pow(2);
}