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

Tim Taubert ttaubert at mozilla.com
Mon Dec 17 08:11:55 PST 2012


On 12/17/2012 04:42 PM, Patrick Walton wrote:
> On 12/17/12 6:42 AM, Tim Taubert wrote:
>> Is there anything I can do about this other than using managed boxes? I
>> really don't want to force people to use GC.
> 
> 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).

Sorry, to clarify: rustc shows the same warnings for insert() and
remove(), so it's not only find().

> Incidentally, that warning may be turned off by default in the future,
> since it's incompatible with the new Clone trait and can be annoying in
> cases like this.
> 
> Patrick
> 
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev


More information about the Rust-dev mailing list