1
- // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1
+ // Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2
2
// file at the top-level directory of this distribution and at
3
3
// http://rust-lang.org/COPYRIGHT.
4
4
//
@@ -76,7 +76,7 @@ impl DefaultResizePolicy {
76
76
// min_capacity(size) must be smaller than the internal capacity,
77
77
// so that the map is not resized:
78
78
// `min_capacity(usable_capacity(x)) <= x`.
79
- // The lef -hand side can only be smaller due to flooring by integer
79
+ // The left -hand side can only be smaller due to flooring by integer
80
80
// division.
81
81
//
82
82
// This doesn't have to be checked for overflow since allocation size
@@ -838,8 +838,8 @@ impl<K, V, S, H> HashMap<K, V, S>
838
838
/// map.insert("b", 2);
839
839
/// map.insert("c", 3);
840
840
///
841
- /// for key in map.values() {
842
- /// println!("{}", key );
841
+ /// for val in map.values() {
842
+ /// println!("{}", val );
843
843
/// }
844
844
/// ```
845
845
#[ stable]
@@ -938,7 +938,7 @@ impl<K, V, S, H> HashMap<K, V, S>
938
938
search_entry_hashed ( & mut self . table , hash, key)
939
939
}
940
940
941
- /// Return the number of elements in the map.
941
+ /// Returns the number of elements in the map.
942
942
///
943
943
/// # Example
944
944
///
@@ -953,7 +953,7 @@ impl<K, V, S, H> HashMap<K, V, S>
953
953
#[ stable]
954
954
pub fn len ( & self ) -> uint { self . table . size ( ) }
955
955
956
- /// Return true if the map contains no elements.
956
+ /// Returns true if the map contains no elements.
957
957
///
958
958
/// # Example
959
959
///
@@ -1274,7 +1274,7 @@ impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S>
1274
1274
}
1275
1275
}
1276
1276
1277
- /// HashMap iterator
1277
+ /// HashMap iterator.
1278
1278
#[ stable]
1279
1279
pub struct Iter < ' a , K : ' a , V : ' a > {
1280
1280
inner : table:: Iter < ' a , K , V >
@@ -1289,13 +1289,13 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
1289
1289
}
1290
1290
}
1291
1291
1292
- /// HashMap mutable values iterator
1292
+ /// HashMap mutable values iterator.
1293
1293
#[ stable]
1294
1294
pub struct IterMut < ' a , K : ' a , V : ' a > {
1295
1295
inner : table:: IterMut < ' a , K , V >
1296
1296
}
1297
1297
1298
- /// HashMap move iterator
1298
+ /// HashMap move iterator.
1299
1299
#[ stable]
1300
1300
pub struct IntoIter < K , V > {
1301
1301
inner : iter:: Map <
@@ -1306,7 +1306,7 @@ pub struct IntoIter<K, V> {
1306
1306
>
1307
1307
}
1308
1308
1309
- /// HashMap keys iterator
1309
+ /// HashMap keys iterator.
1310
1310
#[ stable]
1311
1311
pub struct Keys < ' a , K : ' a , V : ' a > {
1312
1312
inner : Map < ( & ' a K , & ' a V ) , & ' a K , Iter < ' a , K , V > , fn ( ( & ' a K , & ' a V ) ) -> & ' a K >
@@ -1321,7 +1321,7 @@ impl<'a, K, V> Clone for Keys<'a, K, V> {
1321
1321
}
1322
1322
}
1323
1323
1324
- /// HashMap values iterator
1324
+ /// HashMap values iterator.
1325
1325
#[ stable]
1326
1326
pub struct Values < ' a , K : ' a , V : ' a > {
1327
1327
inner : Map < ( & ' a K , & ' a V ) , & ' a V , Iter < ' a , K , V > , fn ( ( & ' a K , & ' a V ) ) -> & ' a V >
@@ -1336,7 +1336,7 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
1336
1336
}
1337
1337
}
1338
1338
1339
- /// HashMap drain iterator
1339
+ /// HashMap drain iterator.
1340
1340
#[ unstable = "matches collection reform specification, waiting for dust to settle" ]
1341
1341
pub struct Drain < ' a , K : ' a , V : ' a > {
1342
1342
inner : iter:: Map <
@@ -1347,35 +1347,35 @@ pub struct Drain<'a, K: 'a, V: 'a> {
1347
1347
>
1348
1348
}
1349
1349
1350
- /// A view into a single occupied location in a HashMap
1350
+ /// A view into a single occupied location in a HashMap.
1351
1351
#[ unstable = "precise API still being fleshed out" ]
1352
1352
pub struct OccupiedEntry < ' a , K : ' a , V : ' a > {
1353
1353
elem : FullBucket < K , V , & ' a mut RawTable < K , V > > ,
1354
1354
}
1355
1355
1356
- /// A view into a single empty location in a HashMap
1356
+ /// A view into a single empty location in a HashMap.
1357
1357
#[ unstable = "precise API still being fleshed out" ]
1358
1358
pub struct VacantEntry < ' a , K : ' a , V : ' a > {
1359
1359
hash : SafeHash ,
1360
1360
key : K ,
1361
1361
elem : VacantEntryState < K , V , & ' a mut RawTable < K , V > > ,
1362
1362
}
1363
1363
1364
- /// A view into a single location in a map, which may be vacant or occupied
1364
+ /// A view into a single location in a map, which may be vacant or occupied.
1365
1365
#[ unstable = "precise API still being fleshed out" ]
1366
1366
pub enum Entry < ' a , K : ' a , V : ' a > {
1367
- /// An occupied Entry
1367
+ /// An occupied Entry.
1368
1368
Occupied ( OccupiedEntry < ' a , K , V > ) ,
1369
- /// A vacant Entry
1369
+ /// A vacant Entry.
1370
1370
Vacant ( VacantEntry < ' a , K , V > ) ,
1371
1371
}
1372
1372
1373
- /// Possible states of a VacantEntry
1373
+ /// Possible states of a VacantEntry.
1374
1374
enum VacantEntryState < K , V , M > {
1375
1375
/// The index is occupied, but the key to insert has precedence,
1376
- /// and will kick the current one out on insertion
1376
+ /// and will kick the current one out on insertion.
1377
1377
NeqElem ( FullBucket < K , V , M > , uint ) ,
1378
- /// The index is genuinely vacant
1378
+ /// The index is genuinely vacant.
1379
1379
NoElem ( EmptyBucket < K , V , M > ) ,
1380
1380
}
1381
1381
@@ -1453,7 +1453,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
1453
1453
1454
1454
#[ unstable = "matches collection reform v2 specification, waiting for dust to settle" ]
1455
1455
impl < ' a , K , V > Entry < ' a , K , V > {
1456
- /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
1456
+ /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant.
1457
1457
pub fn get ( self ) -> Result < & ' a mut V , VacantEntry < ' a , K , V > > {
1458
1458
match self {
1459
1459
Occupied ( entry) => Ok ( entry. into_mut ( ) ) ,
@@ -1464,12 +1464,12 @@ impl<'a, K, V> Entry<'a, K, V> {
1464
1464
1465
1465
#[ unstable = "matches collection reform v2 specification, waiting for dust to settle" ]
1466
1466
impl < ' a , K , V > OccupiedEntry < ' a , K , V > {
1467
- /// Gets a reference to the value in the entry
1467
+ /// Gets a reference to the value in the entry.
1468
1468
pub fn get ( & self ) -> & V {
1469
1469
self . elem . read ( ) . 1
1470
1470
}
1471
1471
1472
- /// Gets a mutable reference to the value in the entry
1472
+ /// Gets a mutable reference to the value in the entry.
1473
1473
pub fn get_mut ( & mut self ) -> & mut V {
1474
1474
self . elem . read_mut ( ) . 1
1475
1475
}
0 commit comments