export send_map and use fewer impl names

This commit is contained in:
Niko Matsakis 2012-07-27 14:52:15 -07:00
parent 638491712e
commit dd106ba763
2 changed files with 9 additions and 8 deletions

View File

@ -15,7 +15,7 @@ type eqfn<K> = pure fn~(K, K) -> bool;
/// Open addressing with linear probing.
mod linear {
export linear_map, linear_map_with_capacity;
export linear_map, linear_map_with_capacity, public_methods;
const initial_capacity: uint = 32u; // 2^5
type bucket<K,V> = {hash: uint, key: K, value: V};
@ -64,7 +64,7 @@ mod linear {
p as &K
}
impl private_const_methods<K,V> for &const linear_map<K,V> {
impl private_methods<K,V> for &const linear_map<K,V> {
#[inline(always)]
pure fn to_bucket(h: uint) -> uint {
// FIXME(#3041) borrow a more sophisticated technique here from
@ -130,7 +130,7 @@ mod linear {
}
}
impl private_mut_methods<K,V> for &mut linear_map<K,V> {
impl private_methods<K,V> for &mut linear_map<K,V> {
/// Expands the capacity of the array and re-inserts each
/// of the existing buckets.
fn expand() {
@ -179,7 +179,7 @@ mod linear {
}
}
impl mut_methods<K,V> for &mut linear_map<K,V> {
impl public_methods<K,V> for &mut linear_map<K,V> {
fn insert(+k: K, +v: V) -> bool {
if self.size >= self.resize_at {
// n.b.: We could also do this after searching, so
@ -233,13 +233,13 @@ mod linear {
}
}
impl private_imm_methods<K,V> for &linear_map<K,V> {
impl private_methods<K,V> for &linear_map<K,V> {
fn search(hash: uint, op: fn(x: &option<bucket<K,V>>) -> bool) {
let _ = self.bucket_sequence(hash, |i| op(&self.buckets[i]));
}
}
impl const_methods<K,V> for &const linear_map<K,V> {
impl public_methods<K,V> for &const linear_map<K,V> {
fn size() -> uint {
self.size
}
@ -252,7 +252,7 @@ mod linear {
}
}
impl const_methods<K,V: copy> for &const linear_map<K,V> {
impl public_methods<K,V: copy> for &const linear_map<K,V> {
fn find(k: &K) -> option<V> {
alt self.bucket_for_key(self.buckets, k) {
found_entry(idx) => {

View File

@ -23,7 +23,8 @@ import core::*;
export net, net_tcp, net_ip, net_url;
export uv, uv_ll, uv_iotask, uv_global_loop;
export c_vec, util, timer;
export bitv, deque, fun_treemap, list, map, smallintmap, sort, treemap;
export bitv, deque, fun_treemap, list, map, send_map;
export smallintmap, sort, treemap;
export rope, arena, par;
export ebml, dbg, getopts, json, rand, sha1, term, time, prettyprint;
export test, tempfile, serialization;