mirror of
https://github.com/serde-rs/json.git
synced 2025-10-01 23:11:39 +00:00
Merge pull request #585 from Nilix007/add_from_unit_for_value
Add `impl From<()> for Value`
This commit is contained in:
commit
bf8cc6642f
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user