Skip to content

BTreeMap doesn't have IndexMut trait #32170

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
abbradar opened this issue Mar 10, 2016 · 2 comments
Closed

BTreeMap doesn't have IndexMut trait #32170

abbradar opened this issue Mar 10, 2016 · 2 comments
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@abbradar
Copy link

As we already have get() and Index, and also get_mut() it's strange not to have IndexMut -- it should be pretty straightforward using get_mut():

impl<'a, K, Q, V> IndexMut<&'a Q> for BTreeMap<K, V>
  where K: Ord + Borrow<Q>, Q: Ord + ?Sized {
    fn index_mut(&mut self, index: &Q) -> &mut Self::Output {
      self.get_mut(index).unwrap()
    }
}
@sfackler
Copy link
Member

These have been intentionally left off to make sure that there won't be any breakage if/when IndexAssign traits are added.

@steveklabnik steveklabnik added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed A-libs labels Mar 24, 2017
@Mark-Simulacrum
Copy link
Member

Closing in favor of #25034.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants