@@ -975,6 +975,7 @@ Operation | Collections
975
975
` fn insert(&mut self, K::Owned) -> bool ` | ` HashSet ` , ` TreeSet ` , ` TrieSet ` , ` BitvSet `
976
976
` fn insert(&mut self, K::Owned, V) -> Option<V> ` | ` HashMap ` , ` TreeMap ` , ` TrieMap ` , ` SmallIntMap `
977
977
` fn append(&mut self, Self) ` | ` DList `
978
+ ` fn prepend(&mut self, Self) ` | ` DList `
978
979
979
980
There are a few changes here from the current state of affairs:
980
981
@@ -1238,13 +1239,13 @@ fn difference<'a>(&'a self, other: &'a Self) -> I;
1238
1239
fn symmetric_difference <'a >(& 'a self , other : & 'a Self ) -> I ;
1239
1240
```
1240
1241
1241
- where the ` I ` type is an iterator over keys that varies by concrete set. Working
1242
- with these iterators avoids materializing intermediate sets when they're not
1243
- needed; the ` collect ` method can be used to create sets when they are.
1244
-
1245
- To clarify the API, this RFC proposes renaming the methods to ` iter_or ` ,
1246
- ` iter_and ` , ` iter_sub ` , and ` iter_xor ` respectively. These names emphasize the
1247
- fact that the methods return iterators, which may be surprising .
1242
+ where the ` I ` type is an iterator over keys that varies by concrete
1243
+ set. Working with these iterators avoids materializing intermediate
1244
+ sets when they're not needed; the ` collect ` method can be used to
1245
+ create sets when they are. This RFC proposes to keep these names
1246
+ intact, following the
1247
+ [ RFC ] ( https://github.com/rust-lang/rfcs/pull/344 ) on iterator
1248
+ conventions .
1248
1249
1249
1250
Sets should also implement the ` BitOr ` , ` BitAnd ` , ` BitXor ` and ` Sub ` traits from
1250
1251
` std::ops ` , allowing overloaded notation ` | ` , ` & ` , ` |^ ` and ` - ` to be used with
@@ -1487,13 +1488,15 @@ v.push_all_move(some_vec);
1487
1488
v . extend (some_vec );
1488
1489
```
1489
1490
1490
- However, currently the ` push_all ` and ` push_all_move ` methods can rely on the
1491
- * exact* size of the container being pushed, in order to elide bounds checks. We
1492
- do not currently have a way to "trust" methods like ` len ` on iterators to elide
1493
- bounds checks. A separate RFC will introduce the notion of a "trusted" method
1494
- which should support such optimization and allow us to deprecate the ` push_all `
1495
- and ` push_all_move ` variants. (This is unlikely to happen before 1.0, so the
1496
- methods will probably still be included with "experimental" status.)
1491
+ However, currently the ` push_all ` and ` push_all_move ` methods can rely
1492
+ on the * exact* size of the container being pushed, in order to elide
1493
+ bounds checks. We do not currently have a way to "trust" methods like
1494
+ ` len ` on iterators to elide bounds checks. A separate RFC will
1495
+ introduce the notion of a "trusted" method which should support such
1496
+ optimization and allow us to deprecate the ` push_all ` and
1497
+ ` push_all_move ` variants. (This is unlikely to happen before 1.0, so
1498
+ the methods will probably still be included with "experimental"
1499
+ status, and likely with different names.)
1497
1500
1498
1501
# Alternatives
1499
1502
@@ -1767,4 +1770,5 @@ Using the `Borrow` trait, it might be possible to safely add a coercion for auto
1767
1770
For sized types, this coercion is * forced* to be trivial, so the only time it
1768
1771
would involve running user code is for unsized values.
1769
1772
1770
- A general story about such coercions will be left to a follow-up RFC.
1773
+ A general story about such coercions will be left to a
1774
+ [ follow-up RFC] ( https://github.com/rust-lang/rfcs/pull/241 ) .
0 commit comments