Like `insert` but returns an error on allocation failure.
(
&mut self,
key: K,
value: V,
forest: &mut MapForest<K, V>,
comp: &C,
)
| 142 | |
| 143 | /// Like `insert` but returns an error on allocation failure. |
| 144 | pub fn try_insert<C: Comparator<K>>( |
| 145 | &mut self, |
| 146 | key: K, |
| 147 | value: V, |
| 148 | forest: &mut MapForest<K, V>, |
| 149 | comp: &C, |
| 150 | ) -> Result<Option<V>, OutOfMemory> { |
| 151 | self.cursor_mut(forest, comp).try_insert(key, value) |
| 152 | } |
| 153 | |
| 154 | /// Remove `key` from the map and return the removed value for `key`, if any. |
| 155 | pub fn remove<C: Comparator<K>>( |
no test coverage detected