Skip to content

BTreeMap doesn't have IndexMut trait #32170

Closed
@abbradar

Description

@abbradar

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()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions