(&mut self, key: &K)
| 108 | } |
| 109 | |
| 110 | pub fn remove(&mut self, key: &K) -> Option<V> { |
| 111 | match self { |
| 112 | Self::Small(list) => Self::key_pos(list, key).map(|idx| list.swap_remove(idx).1), |
| 113 | Self::Large(map) => map.remove(key), |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | /// Returns the position of `key` in `list`, if any. |
| 118 | fn key_pos(list: &[(K, V)], key: &K) -> Option<usize> { |