| 663 | } |
| 664 | |
| 665 | pub fn map_m<F>(&self, f: F) |
| 666 | where |
| 667 | F: Fn(&K, &V) + Send + Sync + 'static, |
| 668 | K: Send + Sync + 'static, |
| 669 | V: Send + Sync + 'static, |
| 670 | { |
| 671 | let f = Arc::new(f); |
| 672 | let handles: Vec<_> = self |
| 673 | .hash_table_list |
| 674 | .iter() |
| 675 | .map(|ht| { |
| 676 | let ht = Arc::clone(ht); |
| 677 | let f = f.clone(); |
| 678 | thread::spawn(move || { |
| 679 | let ht = ht.lock().unwrap(); |
| 680 | for (k, v) in ht.iter() { |
| 681 | f(k, v); |
| 682 | } |
| 683 | }) |
| 684 | }) |
| 685 | .collect(); |
| 686 | |
| 687 | for handle in handles { |
| 688 | handle.join().unwrap(); |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | pub fn to_list(&self) -> Vec<(K, V)> |
| 693 | where |