fish_lib/traits/
into_arc_map.rs

1use std::collections::HashMap;
2use std::sync::Arc;
3
4pub trait IntoArcMap<K, V> {
5    fn into_arc_map(self) -> HashMap<K, Arc<V>>;
6}
7
8impl<K, V> IntoArcMap<K, V> for HashMap<K, V>
9where
10    K: Eq + std::hash::Hash,
11{
12    fn into_arc_map(self) -> HashMap<K, Arc<V>> {
13        self.into_iter().map(|(k, v)| (k, Arc::new(v))).collect()
14    }
15}