about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/str.rs1
-rw-r--r--src/libstd/map.rs6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 8584d4f1524..5c02571ef97 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -54,6 +54,7 @@ export
 
    // Comparing strings
    eq,
+   eq_slice,
    le,
    hash,
 
diff --git a/src/libstd/map.rs b/src/libstd/map.rs
index 071ef5952e0..699cf7a66e9 100644
--- a/src/libstd/map.rs
+++ b/src/libstd/map.rs
@@ -389,6 +389,12 @@ fn hashmap<K: const, V: copy>(+hasher: hashfn<K>, +eqer: eqfn<K>)
     chained::mk(hasher, eqer)
 }
 
+/// Construct a hashmap for string-slice keys
+fn str_slice_hash<V: copy>() -> hashmap<&str, V> {
+    return hashmap(|s| hash::hash_str(*s) as uint,
+                   |a,b| str::eq_slice(*a, *b));
+}
+
 /// Construct a hashmap for string keys
 fn str_hash<V: copy>() -> hashmap<~str, V> {
     return hashmap(str::hash, str::eq);