News for hackers. Stuff that matters.
Re:Fighting Rust's Expressive Type System by ReactiveJelly on Sunday October 25, 2020 @10:56AM (#24886734)
Yeah it's not intuitive, but there isn't really another way to do it, right? Every concrete iterator is specific to what it returns and what it iterates over.

I think it's documented under something like "How to implement Iterator" but if that's not where people will go looking when they need it, then it should be somewhere else.

Re:Fighting Rust's Expressive Type System by lostmsu on Monday October 26, 2020 @02:56AM (#24893456)
In C# and Python you can write an iterator using `yield` keyword. E.g.

   for(i in array) yield i
The language then transforms this into an implementation of the base iterator interface under the hood.