Skip to content

Commit 9c17352

Browse files
committed
---
yaml --- r: 51123 b: refs/heads/try c: 1dd11c7 h: refs/heads/master i: 51121: 3cebab6 51119: 6a3f64e v: v3
1 parent 2780a0c commit 9c17352

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: f7a2371c176663d59062ec5158f39faecba45768
5-
refs/heads/try: 2c658fabedcb4d8ca0d8c6e95184bc4ec0ae45aa
5+
refs/heads/try: 1dd11c717922fb38e87644606f9fbc9d29ee4995
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/hashmap.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,16 @@ pub mod linear {
393393
}
394394
}
395395
396-
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
396+
pub impl<K: Hash + IterBytes + Eq, V> LinearMap<K, V> {
397397
/// Create an empty LinearMap
398398
fn new() -> LinearMap<K, V> {
399-
linear_map_with_capacity(INITIAL_CAPACITY)
399+
LinearMap::with_capacity(INITIAL_CAPACITY)
400+
}
401+
402+
/// Create an empty LinearMap with space for at least `n` elements in
403+
/// the hash table.
404+
fn with_capacity(capacity: uint) -> LinearMap<K, V> {
405+
linear_map_with_capacity(capacity)
400406
}
401407
402408
/// Reserve space for at least `n` elements in the hash table.
@@ -652,7 +658,15 @@ pub mod linear {
652658

653659
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
654660
/// Create an empty LinearSet
655-
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
661+
fn new() -> LinearSet<T> {
662+
LinearSet::with_capacity(INITIAL_CAPACITY)
663+
}
664+
665+
/// Create an empty LinearSet with space for at least `n` elements in
666+
/// the hash table.
667+
fn with_capacity(capacity: uint) -> LinearSet<T> {
668+
LinearSet { map: LinearMap::with_capacity(capacity) }
669+
}
656670

657671
/// Reserve space for at least `n` elements in the hash table.
658672
fn reserve_at_least(&mut self, n: uint) {

0 commit comments

Comments
 (0)