Parse Option<T> into Value/ValueRef where applicable

This commit is contained in:
Will Dowd
2019-09-27 16:02:37 -04:00
parent 104188055e
commit 49f48a5c56
2 changed files with 20 additions and 0 deletions

View File

@@ -96,6 +96,16 @@ impl From<Vec<u8>> for Value {
}
}
impl <T> From<Option<T>> for Value
where T: Into<Value> {
fn from(v: Option<T>) -> Value {
match v {
Some(x) => x.into(),
None => Value::Null,
}
}
}
impl Value {
pub fn data_type(&self) -> Type {
match *self {