[rust-dev] purely function red-black tree
stevej at fruitless.org
Tue Dec 18 16:45:54 PST 2012
On Sat, Dec 15, 2012 at 7:02 PM, Nathan <nejucomo at gmail.com> wrote:
> > Also, traverse should probably belong in its own trait.
> It seems like traversal over keys *and* values is quite useful,
> because it's common for applications to need both, and doing a
> separate lookup when a traversal is already "close to" the value would
> be a shame (changing asymptotic bounds on some applications).
> There is already an Iter trait. Is traversal simply an Iter over
> either K or (K, V) ?
Thanks, I converted my code to implement BaseIter (although my
implementation of size_hint is a little hacky since I'm not tracking the
size of the tree)
> > The private methods are part of the RBMap specialization of the Map trait
> > and are required to reduce boilerplate. They don't belong in a Map trait
> > proper.
> The rust way to do this is to have the trait methods call helper
> functions which are in scope, but not attached to the trait, I
Aha, that helps things click for me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rust-dev