Conversation
dtolnay
left a comment
There was a problem hiding this comment.
Can you share an example where having this impl would be helpful?
|
Mh. So I was working on a library which uses diesel's Anyway, long story short, I think that the conversion from this PR would be quite convenient for the end user of my lib. And as it kinda feels "natural" to me, I sent this PR. |
|
What do you mean by "pulling in the complete serde dependency tree"? If you depend on serde_json to use Value, that depends on serde anyway. Do you prefer Into<Value> over: fn do_something(additional_data: impl Serialize)which would be more flexible? |
Err, you're right, of course. Please ignore this part 😬
Yes, because serde's serialization (and |
|
Published in 1.0.42. |
Add `impl From<()> for Value`
Hey there,
this tiny PR adds the conversion from
()toValue::Null.I feel this is justified as serde_json already perceives
()as the JSON valuenull:https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0eac935756f3537acdf45486dcabb4db
Cheers,
Felix
PS: Please have a look at the marvelous signature of
<Value as From<()>>::from😆