Re:Rust for C++ programmers – part 2: control flow
by masklinn on Sunday April 20, 2014 @04:07AM
(#7616212)
> You'd have to overload "for" to detect whether the expression implemented Iterable or Iterator to decide what to do
Iterator implements Iterable as a trivial self-return (by default), and `for` only and always takes an Iterable?
> what if you implement both?
Depends what sort of weirdness you're trying to do I guess.
> I believe it didn't work with the trait matching rules.
Ah. Too bad.
[1]: https://github.com/mozilla/rust/issues/7597