Insert the given key-value pair, returning the old value if it exists.
(&mut self, k: K, v: V)
| 113 | |
| 114 | /// Insert the given key-value pair, returning the old value if it exists. |
| 115 | pub fn insert(&mut self, k: K, v: V) -> Option<V> { |
| 116 | self.try_insert(k, v).panic_on_oom() |
| 117 | } |
| 118 | |
| 119 | /// Like `insert` but returns an error on allocation failure. |
| 120 | pub fn try_insert(&mut self, k: K, v: V) -> Result<Option<V>, OutOfMemory> { |