Please see:
http://smallcultfollowing.com/babysteps/blog/2013/10/24/iterators-yielding-mutable-references/
http://smallcultfollowing.com/babysteps/blog/2013/10/24/iterators-yielding-mutable-references-take-2/
Those posts discuss a lot of things, but I believe the also cover the
tradeoffs involved in distinguishing these two kinds of signatures.
Niko
On Fri, Dec 06, 2013 at 03:50:59PM +0000, Bill Myers wrote:
> Maybe the language should be changed to allow Iterator to be changed to have
> a signature like this:
> pub trait Iterator<A> {
> fn next<'a>(&'a mut self) -> Option<'a A>;
> }
>
> Then you could return the &mut by reborrowing and would be able to advance
> the iterator without issue afterwards.
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev