Skip to content

Commit 4ca734f

Browse files
committed
Accepted RFC 34: Index trait reform
1 parent 57af2e9 commit 4ca734f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

active/0000-index-traits.md renamed to active/0034-index-traits.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
- Start Date: 2014-06-09
2-
- RFC PR #: (leave this empty)
2+
- RFC PR #: #111
33
- Rust Issue #: #6515
44

55
# Summary
66

7-
`Index` should be split into `Index`, `IndexMut`, and `IndexAssign`
7+
`Index` should be split into `Index` and `IndexMut`.
88

99
# Motivation
1010

@@ -14,7 +14,7 @@ Additionally, this simply follows the `Deref`/`DerefMut` split that has been imp
1414

1515
# Detailed design
1616

17-
We split `Index` into three traits (borrowed from @nikomatsakis):
17+
We split `Index` into two traits (borrowed from @nikomatsakis):
1818

1919
// self[element] -- if used as rvalue, implicitly a deref of the result
2020
trait Index<E,R> {
@@ -26,16 +26,13 @@ We split `Index` into three traits (borrowed from @nikomatsakis):
2626
fn index_mut<'a>(&'a mut self, element: &E) -> &'a mut R;
2727
}
2828

29-
// self[element] = value
30-
trait IndexSet<E,V> {
31-
fn index_set(&mut self, element: E, value: V);
32-
}
33-
3429
# Drawbacks
3530

3631
* The number of lang. items increases.
3732

38-
* This design doesn't support moving out of a vector-like object.
33+
* This design doesn't support moving out of a vector-like object. This can be added backwards compatibly.
34+
35+
* This design doesn't support hash tables because there is no assignment operator. This can be added backwards compatibly.
3936

4037
# Alternatives
4138

0 commit comments

Comments
 (0)