Inserts `value` into the [`CtOption`], then returns a mutable reference to it. If the option already contains a value, the old value is dropped.
(&mut self, value: T)
| 167 | /// |
| 168 | /// If the option already contains a value, the old value is dropped. |
| 169 | pub fn insert(&mut self, value: T) -> &mut T { |
| 170 | self.value = value; |
| 171 | self.is_some = Choice::TRUE; |
| 172 | &mut self.value |
| 173 | } |
| 174 | |
| 175 | /// Conditionally inserts `value` into the [`CtOption`] if the given condition holds. |
| 176 | pub fn insert_if(&mut self, value: &T, condition: Choice) |