-
Notifications
You must be signed in to change notification settings - Fork 13.3k
auto: oldmap: use &K instead of K in find and get #4777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Just curious, but is there a vision at some point for making this nice for keys which can actually be copied? Before I was able to have things like:
I do agree that for most of rust it's necessary to have I took a look at the Again, just a general question, I think the container work you've been doing is awesome and things are becoming far more unified than when I started to use rust (0.5 release as comparison) |
@alexcrichton: It's a little bit uglier for small implicitly copyable types (the built-in integer types), but there isn't a performance loss and I can't think of any better alternatives. The Using |
Oh I completely understand why it's the wait it is, I was just curious if there were any visions for making this syntactically nicer or somehow controllable. Thanks for the explanation! |
@alexcrichton One option might be to make an alternate map interface that is intended for copyable keys which is implemented for all maps, like:
Probably we would want to find a nicer name than |
Hmm... I wouldn't be in favor of something like Would something like this be out of the question?
It's kind of an odd workaround, but the
I'm not sure if this is even possible. I don't quite have a complete grasp on where methods go and how you access them when dealing with traits, so this could just not even work. Regardless, I was just looking into if there was an easy way to use the maps as naturally as possible. When I first started using rust I was really confused that I had to write |
continuing the work from #4746