[rust-dev] simple hash map for storing structs that contain ~str and/or ~[]

Tim Taubert ttaubert at mozilla.com
Mon Dec 17 09:43:07 PST 2012

On 12/17/2012 04:42 PM, Patrick Walton wrote:
> Try returning a reference from find() instead. It's warning you that
> find() is copying out the data (since it returns V and not &V).

I read up on borrowed pointers and made find() return &self/V. After
turning this:

impl<K:Eq IterBytes Hash, V: Copy> LinearMap<K, V>: Map<K, V> {

into this:

impl<K:Eq IterBytes Hash, V> LinearMap<K, V>: Map<K, V> {

(removing the Copy trait from V) it all worked as expected. Thanks for
leading me into the right direction!

- Tim

More information about the Rust-dev mailing list