Sets the value of the entry with the `VacantEntry`'s key.
(self, value: V)
| 47 | impl<'a, K, V> VacantEntry<'a, K, V> { |
| 48 | /// Sets the value of the entry with the `VacantEntry`'s key. |
| 49 | pub fn insert(self, value: V) { |
| 50 | let val = Val { |
| 51 | value, |
| 52 | level: self.depth, |
| 53 | generation: self.generation, |
| 54 | }; |
| 55 | match self.entry { |
| 56 | InsertLoc::Vacant(v) => { |
| 57 | v.insert(val); |
| 58 | } |
| 59 | InsertLoc::Occupied(mut o) => { |
| 60 | *o.get_mut() = val; |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /// A view into a single entry in a map, which may either be vacant or occupied. |