rust@octodon.social ("Rust tips") wrote:
The `.get()` method on a `Vec` or `HashMap` will only temporarily borrow an item, and you won't be allowed to move it or use it outside of the scope of the `.get()` call.
If you want to get an _owned_, freely movable value, use `.remove()` instead.
If you need to have an owned value without removing elements from the collection, you're going to have to clone. Clone can be fast if items are wrapped in `Rc` or `Arc`.
https://play.rust-lang.org/?gist=a7ccfd499aaafc4a3cb35d6e4dd16e03 #rustlang