Extending deref/index with ownership transfer: DerefMove, IndexMove, IndexSet
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rfcs/issues/997)* It is clear that there is a need for the ability to move out of smart pointers and indexable things (`DerefMove`, `IndexMove`). The other frequently desired option is to `IndexSet`, which would be a special-cased version for indexing in this situation: ``` map[key] = value ``` currently, this is handled via `IndexMut`, but that is sub-optimal, because if the `key` is not already part of the `map`, the result is a panic. ### Basic plan DerefMove/IndexMove/IndexSet should layer on top of the traits we have now. One needs to be careful here because of subtle interactions with autoref and so forth. ### Postponed RFCs - https://github.com/rust-lang/rfcs/pull/178 - https://github.com/rust-lang/rfcs/pull/159 - https://github.com/rust-lang/rfcs/pull/1129 (`map[key] = value`)
Posted by nikomatsakis on Mar 21, 2015, 11:03 AM
Tags
Related issues
- Custom games stuck on "finding server" for all european servers
- Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
- Forza Horizon 6 (2483190)
- Turn off integrated browser for default
- Weekly updates are too frequent
- [BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Raise real-world problems, find people facing the same issue, and discuss solutions.7,500 issues0 comments
github (Sysadmin)
Custom games stuck on "finding server" for all european servers
Feature request: add ACP (Agent Client Protocol) stdio JSON-RPC mode
Forza Horizon 6 (2483190)
Turn off integrated browser for default
Weekly updates are too frequent
[BUG] Max 20x plan: 100% usage after 2 hours of light work (5 commits, no agents)
Add gemini-3.1-pro-preview
[TF2] Feature request: Bring Back Quickplay
Extending deref/index with ownership transfer: DerefMove, IndexMove, IndexSet
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rfcs/issues/997)* It is clear that there is a need for the ability to move out of smart pointers and indexable things (`DerefMove`, `IndexMove`). The other frequently desired option is to `IndexSet`, which would be a special-cased version for indexing in this situation: ``` map[key] = value ``` currently, this is handled via `IndexMut`, but that is sub-optimal, because if the `key` is not already part of the `map`, the result is a panic. ### Basic plan DerefMove/IndexMove/IndexSet should layer on top of the traits we have now. One needs to be careful here because of subtle interactions with autoref and so forth. ### Postponed RFCs - https://github.com/rust-lang/rfcs/pull/178 - https://github.com/rust-lang/rfcs/pull/159 - https://github.com/rust-lang/rfcs/pull/1129 (`map[key] = value`)
Comments (0)
No comments yet. Start the discussion.