Like `insert` but returns an error on allocation failure.
(
&mut self,
key: K,
forest: &mut SetForest<K>,
comp: &C,
)
| 115 | |
| 116 | /// Like `insert` but returns an error on allocation failure. |
| 117 | pub fn try_insert<C: Comparator<K>>( |
| 118 | &mut self, |
| 119 | key: K, |
| 120 | forest: &mut SetForest<K>, |
| 121 | comp: &C, |
| 122 | ) -> Result<bool, OutOfMemory> { |
| 123 | self.cursor(forest, comp).try_insert(key) |
| 124 | } |
| 125 | |
| 126 | /// Remove `key` from the set and return true. |
| 127 | /// |