Skip to content

Commit

Permalink
Add impl From<()> for Value
Browse files Browse the repository at this point in the history
  • Loading branch information
Nilix007 committed Nov 19, 2019
1 parent 7dda823 commit ff5a59c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/value/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,19 @@ impl<T: Into<Value>> ::std::iter::FromIterator<T> for Value {
Value::Array(iter.into_iter().map(Into::into).collect())
}
}

impl From<()> for Value {
/// Convert `()` to `Value`
///
/// # Examples
///
/// ```edition2018
/// use serde_json::Value;
///
/// let u = ();
/// let x: Value = u.into();
/// ```
fn from((): ()) -> Self {
Value::Null
}
}

0 comments on commit ff5a59c

Please sign in to comment.