On Sun, Dec 30, 2012 at 1:16 PM, Niko Matsakis <[email protected]> wrote:

> Oh, one other thing:
>
> Your each() method does not obey the for protocol!  When the callback
> returns false, you should abort iteration altogether.  This presumably
> means you need to do the recursion in a helper method that itself returns
> bool so that you can detect when to carry on and when to abort.
>

Thanks for pointing that out, I didn't realize. I'm working on making each
abortable but noticed that I'm not able to call a function defined in an
anonymous impl from this method, there's an interaction with &self here
that I don't understand.

Here is the error:

red_black_tree.rs:107:8: 107:32 error: type
`&self/red_black_tree::RBMap<'a,'b>` does not implement any method in scope
named `real_each`
red_black_tree.rs:107         self.real_each(f, true);

Here is the call site:
https://github.com/stevej/rustled/blob/master/red_black_tree.rs#L107

And here is the definition of the function real_each:
https://github.com/stevej/rustled/blob/master/red_black_tree.rs#L61

Do you understand what is going on here?

Thanks,
Steve
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to