Parse the input and update the stored value to match.
(&mut self, input: VarInput, local: bool)
| 275 | |
| 276 | /// Parse the input and update the stored value to match. |
| 277 | pub fn set(&mut self, input: VarInput, local: bool) -> Result<(), VarError> { |
| 278 | let v = self.definition.parse(input)?; |
| 279 | |
| 280 | // Validate our parsed value. |
| 281 | self.validate_constraints(v.as_ref())?; |
| 282 | |
| 283 | if local { |
| 284 | self.local_value = Some(v); |
| 285 | } else { |
| 286 | self.local_value = None; |
| 287 | self.staged_value = Some(v); |
| 288 | } |
| 289 | Ok(()) |
| 290 | } |
| 291 | |
| 292 | /// Sets the default value for the variable. |
| 293 | pub fn set_default(&mut self, input: VarInput) -> Result<(), VarError> { |
no test coverage detected