On Mon, Aug 12, 2013 at 2:54 PM, Simon Sapin <[email protected]> wrote:
> fn main() {
> let v = ~[1u, 7, 42, 0];
> let mut it = v.move_iter().enumerate();
> for_!((i, v) in it {
> if v == 42 {
> printfln!("Found it at %u", i);
> break
> }
> } else {
> println("Not found");
> })
> }
>
v.move_iter().position(|a| a == 42)
One of Rust's strengths compared to Python is that we can implement
traits on adaptors and have generic methods.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev