impl From<Option<&String>> for ScubaValue
@@ -224,6 +224,12 @@ impl From<Option<String>> for ScubaValue {
}
}
+impl From<Option<&String>> for ScubaValue {
+ fn from(value: Option<&String>) -> Self {
+ ScubaValue::from(value.map(|s| &s[..]))
+ }
+}
+
impl<'a> From<Option<&'a str>> for ScubaValue {
fn from(value: Option<&'a str>) -> Self {
match value {
@@ -392,6 +398,10 @@ mod tests {
ScubaValue::from(Some("str".to_string())),
ScubaValue::Normal(_)
);
+ assert_matches!(
+ ScubaValue::from(Some(&"str".to_string())),
+ ScubaValue::Normal(_)
+ );
assert_matches!(
ScubaValue::from(None::<String>),
ScubaValue::Null(NullScubaValue::Normal)
