Helper method to extract a single value from any kind of [`VarInput`].
(input: VarInput<'_>)
| 96 | |
| 97 | /// Helper method to extract a single value from any kind of [`VarInput`]. |
| 98 | fn extract_single_value(input: VarInput<'_>) -> Result<&str, VarParseError> { |
| 99 | match input { |
| 100 | VarInput::Flat(value) => Ok(value), |
| 101 | VarInput::SqlSet([value]) => Ok(value), |
| 102 | VarInput::SqlSet(values) => Err(VarParseError::InvalidParameterValue { |
| 103 | invalid_values: values.to_vec(), |
| 104 | reason: "expects a single value".into(), |
| 105 | }), |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | impl<V: Value + Clone> Value for Option<V> { |
| 110 | fn type_name() -> Cow<'static, str> |